tr_get_files | R Documentation |
Function which creates a named list of files in a specified
directory. The list names are trimmed versions of file names, while
contents of the list are the file names themselves. In this way, it can be
easily piped into purrr::map(~read.csv(.x))
to create a named list of
data frames.
tr_get_files(
directory,
pattern = "",
recur = FALSE,
date = FALSE,
remove_string = NULL
)
directory |
Directory containing files to read |
pattern |
Optional, case-sensitive pattern to use in file searching. If no pattern is supplied, all files in the specified directory will be returned. |
recur |
Whether file searching and listing should be done recursively. Defaults to FALSE. |
date |
Do file names contain a date which should be removed? Must be formatted akin to "YYYYMMDD", i.e. all numeric with no spaces, dashes, etc. Defaults to FALSE. |
remove_string |
Optional string which can be removed from file names when creating names for the output list |
Named list of files
None.
https://www.github.com/travis-m-blimkie/tRavis
tr_get_files(
directory = system.file("extdata", package = "tRavis"),
pattern = "test",
remove_string = "test_",
date = TRUE
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.