here_data: Find your data folder

View source: R/here_data.R

here_dataR Documentation

Find your data folder

Description

Uses data_date.txt to create a path with the data date populated.

  • here_data(): Returns here::here("secure_data", data_date, ...)

  • path_data(): Returns fs::path(path, "secure_data", data_date, ...)

Usage

here_data(
  ...,
  data_folder_name = "secure_data",
  path_to_data_date = here::here()
)

path_data(
  ...,
  path = getOption("path_data"),
  data_folder_name = "secure_data",
  path_to_data_date = here::here()
)

get_data_date(path_to_data_date = here::here())

Arguments

...

Path components to be appended to the end of the returned path string.

data_folder_name

name of data folder. Default is "secure_data"

path_to_data_date

path to data date folder or file. If folder is passed, expecting the data date file to be named one of c("data_date.txt", "data_date", "dataDate.txt", "dataDate"). Default value is here::here()

path

path to folder where data is saved, e.g. fs::path(path, ) Default value is getOption("path_data") where path_data can be initialized at the top of the script with options(path_data = "H:/.../data")

Details

The function expects the user to version their data using a text file indicating the date the data was last received, and the data to be stored in a corresponding folder name, e.g. ⁠~/Project Folder/secure_data/2020-01-01⁠.

Value

path to data folder

Examples

if (FALSE) {
here_data()
#> "C:/Users/SjobergD/GitHub/My Project/secure_data/2020-01-01"

here_data("Raw Data.xlsx")
#> "C:/Users/SjobergD/GitHub/My Project/secure_data/2020-01-01/Raw Data.xlsx"

path_data(path = "O:/My Project", "Raw Data.xlsx")
#> "O:/My Project/secure_data/2020-01-01/Raw Data.xlsx"
}

ddsjoberg/bstfun documentation built on July 4, 2023, 10:59 a.m.