Nicktz
11/23/2015 - 1:02 PM

Using lapply to import a list of csv's using read_csv

Using lapply to import a list of csv's using read_csv

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]])
    }