[R] binding two lists of lists of dataframes together

Vin Cheng newrnewbie at hotmail.com
Mon May 11 23:07:02 CEST 2015


 
> From: newrnewbie at hotmail.com
> To: r-help at r-project.org
> Date: Mon, 11 May 2015 20:16:40 +0000
> Subject: [R] binding two lists of lists of dataframes together
> 
>  Hi, 
> I'm new to R and am stumped.  I'm trying to bind List 1 to List 2 and have the corresponding Output.  
>  
> I've found the following code - I can't say I understand rbindlist(lapply(list12, "[", i, TRUE)).  Either way - it doesn't give exactly what's needed.
>  
> library(data.table)
> list12 <- list(List1,List2)
> nr <- as.vector(nrow(list12[[1]]))
> fastbind.ith.rows <- function(i) rbindlist(lapply(list12, "[", i, TRUE))
> fastbound <- lapply(1:nr, fastbind.ith.rows)
>  
> It produces Output 2 - where dataframes are grouped together by rownames, but keeps 2 separate vectors - vs. binding the two into 1 vector.
>  
> Any help/guidance would be greatly appreciated!!
>  
> Thanks!
> Vince
>  
 		 	   		  
-------------- next part --------------
A non-text attachment was scrubbed...
Name: data.pdf
Type: application/pdf
Size: 55729 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20150511/20202f33/attachment.pdf>


More information about the R-help mailing list