Please consider following code : set.seed(1) res <- vector("list") for (i in 1:5) { res1 <- vector("list") res1[[1]] <- letters[1:5] res1[[2]] <- rnorm(5) res1[[3]] <- rnorm(5); res[[i]] <- res1 } res[[1]]
# Now I want to reduce the dimension of "res" through creating a data frame like that mat <- data.frame(nrow=5, ncol=2) for (i in 1:5) { mat[i,1] <- res[[i]][[1]][1] mat[i,2] <- res[[i]][[2]][1] }; mat Here I am looking for more "efficient" code by avoiding the loop. Is there any smart way to do that ? Thanks, -- View this message in context: http://n4.nabble.com/Reducing-the-dimension-of-a-list-object-tp960813p960813.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.