[R] merging data list in to single data frame

Hadley Wickham hadley at rice.edu
Tue Apr 5 00:10:44 CEST 2011


> filelist = list.files(pattern = "K*cd.txt") # the file names are K1cd.txt
> .................to K200cd.txt

It's very easy:

names(filelist) <- basename(filelist)
data_list <- ldply(filelist, read.table, header=T, comment=";", fill=T)

Hadley


-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/



More information about the R-help mailing list