Sometimes you have your data stored in multiple csv files and want to load them into a single data frame in R. There are several answers on the web to this questions and I recently found a fast solution to this problem.
# packages require(data.table) # set wd setwd("PathToYourFolder") # import files files = list.files(pattern="*.csv") dataset = do.call(rbind, lapply(files, fread)) rm(files) # transform data to df dataset <- as.data.frame(unclass(dataset))
The code above uses both lapply and the cool fread function from the data.table package to load in your data in a quiet fast manner. I recommend to try out this approach if you dealing with long import times.
Make sure you check out my Github for other data driven projects.