[R] How to rbind listed data frames?

it-r-help at ml.epigenomics.com it-r-help at ml.epigenomics.com
Tue May 4 13:11:05 CEST 2010


assuming all data frames have the same format
do.call("rbind", dataList)

will concatenate all data frames contained in your list object.

Phil Wieland wrote, On 05/04/10 09:51:
> I made a list (dataList) of data frames. The list looks like this (the
> first two elements):
> 
> [[1]]
>     est         cond                           targets
> 1   400 exo_depth_65                        Hautklinik
> 2   300 exo_depth_65                       Ostturm_UKM
> 3   200 exo_depth_65 Kreuzung_Roxeler/Albert_Schweizer
> ...
> 
> 
> [[2]]
>     est    cond                           targets
> 1   400 control                        Hautklinik
> 2   220 control                       Ostturm_UKM
> 3   300 control Kreuzung_Roxeler/Albert_Schweizer
> ...
> 
> Now I would like to merge the data frames with rbind. It works fine this
> way:
> 
> rbind(dataList[[1]], dataList[[2]], ...)
> 
> but I would like to use lapply or a for loop to get rid of specifying
> the subscripts. The output of lapply(dataList, rbind) is always
> 
>      [,1]   [,2]
> [1,] List,3 List,3
> 
> Thanks for help...
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 


-- 
Matthias Burger                       Project Manager/ Biostatistician
Epigenomics AG     Kleine Praesidentenstr. 1     10178 Berlin, Germany
phone:+49-30-24345-0                              fax:+49-30-24345-555
http://www.epigenomics.com             matthias.burger at epigenomics.com
--
Epigenomics AG Berlin             Amtsgericht Charlottenburg HRB 75861
Vorstand:                             Geert Nygaard (CEO/Vorsitzender)
                                              Oliver Schacht PhD (CFO)
Aufsichtsrat:     Prof. Dr. Dr. hc. Rolf Krebs (Chairman/Vorsitzender)



More information about the R-help mailing list