[R] lapply?

Berend Hasselman bhh at xs4all.nl
Thu Nov 14 16:34:58 CET 2013


On 14-11-2013, at 16:20, Brian Smith <bsmith030465 at gmail.com> wrote:

> Hi,
> 
> I was trying to use lapply to create a matrix from a list:
> 
> uu <- list()
> uu[[1]] <- c(1,2,3)
> uu[[2]] <- c(3,4,5)
> 
> The output I desire is a matrix with 2 rows and 3 columns, so I try:
> 
> xx <- lapply(uu,rbind)
> 
> Obviously, I'm not doing something right, but what!?


do.call(rbind,uu) 

Berend



More information about the R-help mailing list