load.data: Loading Data from a Directory

Description Usage Arguments Note Author(s) See Also Examples

Description

The function automatically loads .csv files, either under the current working directory or the directory specified by the user, as data frames. If a pattern is specified, only files with names matching the pattern will be loaded. The argument merge is used to indicate whether the data frames should be stored in a single list or merged together in one data frame.

Usage

1

Arguments

path

string, indicating the directory under which the files to be loaded are stored. If omitted, files will be loaded from the current working directory.

pattern

character, indicating the pattern to be mathced in the file names. If specified, only files with names matching the pattern will be loaded.

merge

logical, FALSE by default. If TRUE, data frames will be merged based on a common variable name.

Note

R has trouble processing variable names that contain certain special characters, and this might interfere with the merging function. If this happens, the function will stop running and reporting where the error takes place.

Author(s)

Zehua Wu

See Also

df.merge, df.split

Examples

1
2
3
dir="~/Documents/Mydata"
data<-load.data(path=dir, pattern=NULL, merge=TRUE)
write.csv(data, "Merged.csv")

google-trends-v1/gtm documentation built on June 5, 2019, 5:13 p.m.