Skip to contents

formr's file-writing functions (e.g. formr_backup_study(), formr_api_backup_run(), formr_api_pull_project()) never write to your working directory by default. Instead they default their destination to the value stored here, which is unset (NULL) until you choose one — so nothing is ever written until you opt in. Call this function with a path to set a session-wide default, or without arguments to read the current value. The path is held in memory for the current R session only; nothing is written to disk to persist it. There is no separate reset: the value lasts until you overwrite it with another path or your R session ends.

Usage

formr_default_dir(dir = NULL)

Arguments

dir

a single directory path to use as the default. If NULL (the default) the stored value is returned unchanged. The directory itself is created on first write if it does not yet exist.

Value

The current default directory as a length-1 character string, or NULL when none has been set.

Examples

formr_default_dir(tempdir())
#> [1] "/tmp/RtmppKJNtH"
formr_default_dir()
#> [1] "/tmp/RtmppKJNtH"