[R] adding statistical output to a plot
dwinsemius at comcast.net
Sat May 29 14:31:14 CEST 2010
On May 29, 2010, at 8:11 AM, dunner wrote:
> Thanks to both of you,
> I used the below code instead, which has been cleaned and pruned a
> It produces a trellis of qq plots with the proper annotations as per
> from a dataframe passed to mtab.matrix(). However, I can't get
> variable names (these are column names in the passed dataframe) to
> the plots. Perhaps "apply" simply doesn't deal with the colname and
> I have
> to try a completely different method?
apply takes a column and passes it as a vector. I think it still has a
name but perhaps not a colname. Getting the name of a passed object
sometimes requires working with substitute(deparse(x)). Not sure what
paste() would be doing when you are only processing one vector at a
> Or will apply pass enough information
> to the included function (mtab.norm) to allow me to annotate the plot?
> Again, I'm probably missing something banal and wholly obvious.
> qqnorm(x, pch=16, cex=pt.ht, col="darkorange",
> ylab='', main='')
> qqline(x, col="black", lty=2)
> grid(col = "darkgrey", lty=2)
> mtext(paste("Shapiro-Wilks", "\n p =",signif(st.x
> $p.value,digits=4),"\n W
> =",signif(st.x$statistic,digits=4)), line=1, cex=txt.sz, adj=0)
> mtext(paste("Anderson-Darling", "\n p =",signif(adt.x
> $p.value,digits=4), "\n
> W =", signif(adt.x$statistic,digits=4)), line=1, cex=txt.sz, adj=1)}
> pdf(file=paste(colnames(z),".pdf"), paper="a4r", width=0, height=0)
> par(mfcol=c(3,3), mar=c(5.1,4.1,5.1,2.1))
> apply(z, 2, mtab.norm)
> Thanks again for all your help. I am obviously a relative beginner,
> but an
> Dr. Ross Dunne,
> HRB Clinical Research Fellow,
> Dept. of Psychiatry, Trinity College Dublin.
> View this message in context: http://r.789695.n4.nabble.com/adding-statistical-output-to-a-plot-tp2235565p2235629.html
> Sent from the R help mailing list archive at Nabble.com.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
David Winsemius, MD
West Hartford, CT
More information about the R-help