[R] Displaying a summary in graphics

Aram Fingal fingal at multifactorial.com
Fri Aug 5 19:36:56 CEST 2011


I'm writing a script which puts together a bunch of graphs and outputs them to a graphics device.   One of the things I want to add is ANOVA summaries but I'm having trouble with formatting them for graphics.

I do this:

anova_summary <- summary(aov(concentration~inhibition*genotype, data =drug_data))

print(anova_summary)

The printout to the R console is in the format I want but if I do this:

mtext(side=1, outer=TRUE, text=anova_summary, cex=0.75, line=1, adj=0)

I don't get the proper formatting.  

I gather, from the documentation and searching the web, that the issue is that summary() includes a method for print() to format the data but mtext() doesn't follow the method.  If I understand correctly, I need to use something like format() or encodeString() to get the proper formatting for mtext() to use.   The thing is that I haven't figured out anything close to the right parameters to use.  Is there some place which describes how to do this?



More information about the R-help mailing list