[R] combing list objects
chris20
chris.bennett at sheffield.ac.uk
Mon Sep 3 18:06:17 CEST 2012
Hi,
I am trying to combine a long list but I can't work out how to do it, for
example:
abun<-list(rep(0,5),rep(0,7),rep(0,4),rep(0,10))
nb<-c(5,5,1,8)
fill.abun <- function(x, y) {
set <- sample(1:length(x), size = y)
x[set] <- rlnorm(length(set))
return(x)
}
abun <- mapply(fill.abun, abun, nb)
abun
## I want all the data in one list or column which I can extract to a
dataframe or matrix
## the best I have come up with is:
abun2<-c(abun[[1]],abun[[2]],abun[[3]],abun[[4]])
## but I will have a lot more data and so this is not feasible
Thanks,
Chris
--
View this message in context: http://r.789695.n4.nabble.com/combing-list-objects-tp4642071.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list