Fast concatenation of thousands of files by columns

前端 未结 2 1859
遥遥无期
遥遥无期 2021-01-23 03:56

I am using R to cbind about ~11000 files using:

dat <- do.call(\'bind_cols\',lapply(lfiles,read.delim))

which is unbelievably s

2条回答
  •  攒了一身酷
    2021-01-23 04:48

    For fast reading of files, we can use fread from data.table and then rbind the list of data.table using rbindlist specifying the idcol=TRUE to provide a grouping variable to identify each of the datasets

    library(data.table)
    DT <- rbindlist(lapply(lfiles, fread), idcol=TRUE)
    

提交回复
热议问题