[R] Replacing elements of list

Ron_M ron_michael70 at yahoo.com
Mon Mar 22 09:18:13 CET 2010


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, matrix, ncol=4)


Now I want to replace last 4 columns of each matrix at "dat1" with the
corresponding matrix in "dat2". However I want to avoid the time consuming
loop to do that. Is there any way to do that without using loop?

Thanks
-- 
View this message in context: http://n4.nabble.com/Replacing-elements-of-list-tp1677293p1677293.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list