This function reads multiple CSV files in a table format and returns a list of data frames from them, with the names corresponding to the file names. By default it loads all CSV files in the specified path. You can choose what files to read by specifying the name or a regular expression in the pattern.
load_files(path = NULL, pattern = NULL, ignore.case = FALSE, ...)
path | a character vector of full path name of the directory to read from. |
---|---|
pattern | character string containing a regular expression (or a human readable string). |
ignore.case | logical. Should pattern be case-insensitive? |
... | Additional argument passed to |
A list of data frame with names corresponding to the file names. If there is an error in the files, only a list with passed data frames will be returned.
load_files
is used to extract data from multiple CSV files in
preparation for the import. It constructs and maps different paths to the
read_sheet
function.
Files must be comma separated or in a valid CSV format.
Files must abide to the project codes and naming standards.
Path must reference to a valid directory with the project files.
if (FALSE) { # read all the csv files in the specified path path <- "./historical files/NG A360 Master Data- Final Cleaned April & May 19" data <- load_files(path) # load attendance csv files attendance <- load_files(path, pattern = "Attendance") # load service provision csv files sp <- load_files(path, pattern = "Service Provision") }