[R] Merge several datasets into one

ruipbarradas at sapo.pt ruipbarradas at sapo.pt
Fri Jul 1 11:22:02 CEST 2016


Hello,

Maybe something like this.

fls <- list.files(pattern = "*.csv")
dat.list <- lapply(fls, read.csv)
dat <- do.call(rbind, dat.list)

Hope this helps,

Rui Barradas
 

Citando lily li <chocold12 at gmail.com>:

> Hi R users,
>
> I'd like to ask that how to merge several datasets into one in R? I put
> these csv files in one folder, and use the lapply function, but it says
> that cannot open file 'xx.csv'. These files have different names, but end
> with .csv extension, and the files have the same header. Thanks for your
> help.
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide  
> http://www.R-project.org/posting-guide.htmland provide commented,  
> minimal, self-contained, reproducible code.

 

	[[alternative HTML version deleted]]



More information about the R-help mailing list