[R] lapply?

eugene dalt eugenedalt at yahoo.com
Sat Aug 19 16:01:39 CEST 2006


Hi folks,

I would like to know if the following loop can be
rewritten with lapply


list1 <- as.list(0)

testv <- c(4,6,7,8)

for( i in 1:4){

list1[[i]] <- rep(5,testv[i])

}

Thanks in Advance. - Eugene



More information about the R-help mailing list