read_all_csv: read_all_csv

Description Usage Arguments Value Examples

View source: R/read_all_csv.R

Description

This function provides a way of reading all .csv file in the folder.

Usage

1
read_all_csv(path = getwd(), add_variable = TRUE)

Arguments

path

The path from which you want to read all the Microsoft Excel files (with the extension of .xlsx OR .xls). The default value of the parameter path is the current working directory.

add_variable

If the add_variable is TRUE, then an extra variable "file_name" will be added to each data.frame in the output list. The default value is set as TRUE.

Value

a list of dataframes, which can be combined using the rbindlist function in data.table package.

Examples

1
2
3
4
# Let's assume there are three files (A.csv, B.csv, C.csv) in the path "C:/data".
all_csv = read_all_csv(path = "C:/data")
# The above code should read all .csv & .csv files into the list "all_csv". You can access each data.frame by all_csv[["A"]], all_csv[["B"]], and all_csv[["C"]].
# If the parameter "add_variable" is set as TRUE, an extra variable "file_name" will be added to each data.frame in the output list.

caimiao0714/MiaoTruck documentation built on May 28, 2019, 7:14 p.m.