You have a list as output from 'lapply'. To convert back into a matrix use:
do.call(rbind, var21) On Sun, Jun 28, 2009 at 9:01 PM, Shaan Glaz <sha...@ymail.com> wrote: > Hi! > > I want to print the output all together with a single column name > > s21<-c(1:1000); > var21<-lapply(s21,function(x){ > ns<-rnorm(78,8,9); > n<-length(ns); > Mn<-mean(ns) > Sn2<-var(ns) > return(cbind(x,Mn,Sn2)); > }); > var21 > > but my code is giving me somewhat like the following > [[1]] x Mn Sn2 > [1,] 1 7.86 10.56540 > > [[2]] x Mn Sn2 > [1,] 2 8.11 7.685347 > > I want to print the mean and variance as > x Mn Sn2 > 1 7.86 10.56540 > 2 8.11 7.685347 > > Thanks in advance. > > Shaan > > > > [[alternative HTML version deleted]] > > > ______________________________________________ > 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<http://www.r-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. > > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? [[alternative HTML version deleted]] ______________________________________________ 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.