gather.files | R Documentation |
Prepare a set of files to be iteratively read into R
gather.files(dir = ".", extension = NULL, recursive = FALSE)
dir |
Relative path to directory where the files reside (includes the
trailing |
extension |
quoted file extension, accepts 3-letter extension with OR without a preceding "." Verify capitalization. |
recursive |
whether to search sub-directories |
This is a helper function to remove friction and reduce eyesore when reading
multiple data files in one step. A base method with list.files()
works fine
but requires more arguments than I want to remember for this very common task.
This wrapper cleans the path strings to assign nice names to the files as they
are imported.
Output is easily piped to read.files()
to read the files and
compile them in a tibble. Because gather.files
gives nice names to its
elements, the list is more human-readable.
A named character vector of file paths to read. The element names are the base file names with the file extension stripped.
## Not run:
gather.files(dir = "data/raw_data/2020-10-25_Atterberg_limits",
extension= ".csv")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.