By default reads all files in the directory dir that match the pattern
using read_csv
and loads them into the
calling environment after renaming using make.names(unique = TRUE)
.
It is useful for quickly loading the data in a set of files into the workspace
(just call the function at the top level of a script).
ps_load_files(
dir = ".",
pattern = "[.]csv$",
recursive = FALSE,
read = readr::read_csv,
add_name = NULL,
rename = identity,
envir = parent.frame(),
...
)
A string of the directory.
A string of the regular expression to use to identify files.
A flag indicating whether to include files in subdirectories.
A function to read the files.
A string specifying the name of the column to add to each data frame with the file names (including subdirectories).
A function that is used to rename files (after removing the extension) before they are passed to make.names
.
The environment to assign the data frames.
Additional arguments passed to read
.
An invisible character vector of the file names.