Dear R-gurus aa <- data.frame(a1=rnorm(20),b1=rnorm(20,0.8),c1=rnorm(20,0.5)) sapply(aa,function(x) histogram(x,breaks=NULL)) or px <- sapply(aa,function(x) histogram(x,breaks=NULL)) print(px,split=c(1,1,1,1),more=F) The above code does not seem to work. am I missing something? Thanks, Santosh [[alternative HTML version deleted]]
Try this: junk <- sapply(aa,function(x) print(histogram(x,breaks=NULL))) or, shorter: for(a in aa) print(histogram(a, breaks = NULL) On Fri, Mar 19, 2010 at 5:44 PM, Santosh <santosh2005 at gmail.com> wrote:> Dear R-gurus > > aa <- data.frame(a1=rnorm(20),b1=rnorm(20,0.8),c1=rnorm(20,0.5)) > sapply(aa,function(x) histogram(x,breaks=NULL)) > > or px <- sapply(aa,function(x) histogram(x,breaks=NULL)) > print(px,split=c(1,1,1,1),more=F) > > The above code does not seem to work. am I missing something? > > Thanks, > Santosh > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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. >
Try this: histogram(~ values | ind, stack(aa)) On Fri, Mar 19, 2010 at 5:44 PM, Santosh <santosh2005 at gmail.com> wrote:> Dear R-gurus > > aa <- data.frame(a1=rnorm(20),b1=rnorm(20,0.8),c1=rnorm(20,0.5)) > sapply(aa,function(x) histogram(x,breaks=NULL)) > > or px <- sapply(aa,function(x) histogram(x,breaks=NULL)) > print(px,split=c(1,1,1,1),more=F) > > The above code does not seem to work. am I missing something? > > Thanks, > Santosh > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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. >