Created
November 23, 2015 13:02
-
-
Save Nicktz/8404fc914c9886ca5614 to your computer and use it in GitHub Desktop.
Using lapply to import a list of csv's using read_csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The following imports a long list of csv's fast using lapply and read_csv: | |
# File list: | |
data.files <- list.files(production.dataset(Universe,"EQS"),pattern = "*.csv",full.names=TRUE, recursive = FALSE, include.dirs = FALSE) | |
# Import all the files as separate lists | |
df.eqs <- lapply( data.files, function(x) read_csv(x)) | |
# Append the files by row: | |
x <- df.eqs[[1]] | |
for(i in 2:length(df.eqs)){ | |
x <- bind_rows(x,df.eqs[[i]]) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment