find_dropbox_2dii: Easily access directories in your local copy of 2dii's...

View source: R/find_dropbox_2dii.R

find_dropbox_2diiR Documentation

Easily access directories in your local copy of 2dii's Dropbox folder

Description

These functions create cross-platform paths pointing to 2dii's Dropbox folder:

  • find_dropbox_2dii() is user-oriented; it checks the output is an existing path.

  • path_dropbox_2dii() is low-level, developer-oriented; it doesn't care if the output is not an existing path.

Usage

find_dropbox_2dii(...)

path_dropbox_2dii(...)

Arguments

...

Character vectors, if any values are NA, the result will also be NA.

Details

Your projects may need data stored in 2dii's Dropbox folder. Sometimes it is convenient to have your projects close to the data. But, in this case, it is a bad idea because the path to 2dii's Dropbox folder has a problematic space and symbol. (For example, RStudio's Git pane may not work.) Instead, place your projects somewhere with a sane path, such as C:/Users/You/git/project/, and access the data you need with path_dropbox_2dii().

Value

A character string.

Setup for a custom Dropbox folder

If the name of your 2dii Dropbox folder is different from the default, you may add this to .Rprofile (see usethis::edit_r_profile()):

options(r2dii_dropbox = "The name of your custom dropbox folder goes here")

See Also

degrees(), fs::path_home().

Other functions to output 2dii paths: USER.NAME()

Examples

# If it points to a nonexistent directory, path_dropbox_2dii() doesn't care
path_dropbox_2dii("path", "to", "nowhere")

# find_dropbox_2dii() points to an existing directory or tells you if not:
# * It is a warning if the Dropbox folder exists but not the nested path
# * It is an error if the Dropbox folder does not exist:
restore <- options(r2dii_dropbox = "No Dropbox folder here")

dropbox_exists()
try(
  find_dropbox_2dii("path", "to", "nowhere")
)

options(restore)

2DegreesInvesting/r2dii.utils documentation built on March 31, 2022, 11:20 p.m.