It is easy to import a CSV file in R but it is quite difficult to import multiple CSV files in R simultaneously.How we can do that?

653    Asked by MatthewTAYLOR in Data Science , Asked on Nov 18, 2019
Answered by Matthew TAYLOR

For importing multiple CSV file we can use base R package and do the following

files = list.files(pattern="*.csv")

allfiles = lapply(files, read.delim)

Also by importing tidyverse, it can speed up importing the data twice compared to base R package

library(data.table)

tbl_fread <-

        list.files(pattern = "*.csv") %>%

        map_df(~fread(.))



Your Answer

Interviews

Parent Categories