load_files: Read multiple data files (CSV)

Description Usage Arguments Details Value Note Examples

View source: R/load_files.R

Description

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.

Usage

1
load_files(path = NULL, pattern = NULL, ignore.case = FALSE, ...)

Arguments

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 read_sheet

Details

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.

Value

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.

Note

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.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
# 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")

## End(Not run)

INyabuto/a360importer documentation built on Jan. 9, 2020, 4:25 p.m.