path_by_date: Return the Path to a NBS Investigations File

View source: R/path_by_date.R

path_by_dateR Documentation

Return the Path to a NBS Investigations File

Description

path_* functions return paths to one or more files of interest containing the supplied date in their names and ending with the supplied file extension. These are convenience wrappers around path_by_date(), which returns path that contain a specified date given additional parameters.

Usage

path_by_date(
  dir,
  date_format,
  date_regex,
  date = NULL,
  file_regex = ".*{date}.*",
  type = "any",
  force_latest = TRUE
)

path_inv(
  date = NULL,
  dir = path_create("V:/EPI DATA ANALYTICS TEAM/COVID SANDBOX REDCAP DATA/",
    "Sandbox data pull Final/"),
  ext = c("csv", "xlsx", "fst")
)

path_pcr(
  date = NULL,
  dir = "V:/EPI DATA ANALYTICS TEAM/COVID SANDBOX REDCAP DATA/MSR PCR/",
  ext = c("csv", "xlsx", "fst")
)

path_vac(
  date = NULL,
  dir = path_create("V:/EPI DATA ANALYTICS TEAM/COVID SANDBOX REDCAP DATA/",
    "COVID-19 Vaccine Reporting/data/COVID-19 vaccine data pull/"),
  ext = c("csv", "xlsx", "fst")
)

path_nit(date = NULL, force_latest = TRUE)

path_nca(date = NULL, force_latest = TRUE)

Arguments

dir

The directory holding the files of interest

date_format

The format of the date in the file name; see format() for more information

date_regex

A regular expression matching the date in the file name. This will hopefully be deprecated in the future, but is currently needed for extracting dates from the file path strings.

date

A Date or string in the format "YYYY-MM-DD"

file_regex

A regular expression matching the file names of interest. The location of the date in the file name is specified using "{date}", as in the glue package.

type

The file type(s) to return, one or more of "any", "file", "directory", "symlink", "FIFO", "socket", "character_device" or "block_device".

force_latest

If multiple files with the given date are found, should the function return only the file with the latest creation date (TRUE, the default), or should it return all file paths (FALSE)?

ext

The file type to return. Files may be saved as "fst", "csv", or "xlsx".

Details

  • path_inv() returns path(s) to NBS investigations files

  • path_pcr() returns path(s) to NBS PCR files

  • path_vac() returns path(s) to TennIIS vaccination files

  • path_nit() returns path(s) to saved NIT records

  • path_nca() returns path(s) to saved NCA records

This will eventually replace find_file() for finding specific files.

Value

An fs_path character vector


jesse-smith/coviData documentation built on Jan. 14, 2023, 11:08 a.m.