dir_recent | R Documentation |
Use the dir function and utils::tail to get the most recent file in a directory based on the saved name. This is only helpful when files are saved with a sequential naming system, typically this will be a form of the date as it is for PacFIN.Utilities when it saves .RData files.
dir_recent(dir = getwd(), pattern, casespecific = FALSE, verbose = FALSE)
dir |
The directory that you would like to search, either a full or relative path will work. The default is your current working directory. |
pattern |
A character string that you want to search for within
|
casespecific |
A logical value specifying if the call to grep
should be case specific. If |
verbose |
A logical value specifying if output should be printed
to the console or not. The default is |
A single file path to the most recent file within dir
that
matches the character string in pattern
. The full path will be provided.
Kelli Faye Johnson
## Not run:
dir_recent("data-raw", pattern = "Pac.+bds", verbose = TRUE)
dir_recent("data-raw", pattern = "Pac.+ft")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.