path_by_date: Return the Path to a NBS Investigations File

Description Usage Arguments Details Value

View source: R/path_by_date.R

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

1
2
3
4
5
6
7
8
9
path_by_date(
  dir,
  date_format,
  date_regex,
  date = NULL,
  file_regex = ".*{date}.*",
  type = "any",
  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)?

Details

Value

An fs_path character vector


jesse-smith/covidprod documentation built on Oct. 11, 2021, 5:34 p.m.