Re: [R] Replacing elements of list

2010-03-22 Thread Schalk Heunis
lapply will do the trick, try something like lapply(1:length(dat1), function(x,dat1,dat2) cbind(dat1[[x]][,1:2], dat2[[x]]),dat1,dat2) HTH Schalk On Mon, Mar 22, 2010 at 10:18 AM, Ron_M wrote: > > Dear all, > > I have following two list object, both are basically collection of matrices > : > >

[R] Replacing elements of list

2010-03-22 Thread Ron_M
Dear all, I have following two list object, both are basically collection of matrices : dat1 <- matrix(rnorm(25*6), ncol=6) dat1 <- split(dat1, seq(5,25,by=5)) dat1 <- lapply(dat1, matrix, ncol=6) dat2 <- matrix(rnorm(25*4), ncol=4) dat2 <- split(dat2, seq(5,25,by=5)) dat2 <- lapply(dat2, matri