[R] use of 'apply' for 'hist'

casperyc casperyc at hotmail.co.uk
Sat Dec 18 17:49:39 CET 2010


Hi all,

##########################################
dof=c(1,2,4,8,16,32)
Q5=matrix(rt(100,dof),100,6,T,dimnames=list(NULL,dof))
par(mfrow=c(2,6))
apply(Q5,2,hist)
myf=function(x){ qqnorm(x);qqline(x) }
apply(Q5,2,myf)
##########################################

These looks ok.
However, I would like to achieve more.

Apart from using a loop,
is there are fast way to 'add' the titles to be more informative?

that is, in the histograms, I want the titles to be 't distribution with
dof=' the degrees of freedom.

I have tried 
apply(Q5,2,hist,xnames=dof)
which does not work;
apply(Q5,2,hist(,xnames=dof));
does not work either

and similarly, how do I add titles to qqnorm plot 
to make them informative?

Thanks!

casper


-- 
View this message in context: http://r.789695.n4.nabble.com/use-of-apply-for-hist-tp3093811p3093811.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list