[R] Paste expression in graph title
Paul Chatfield
p.s.chatfield at reading.ac.uk
Mon Jan 25 13:06:22 CET 2010
This was my initial attempt at creating a title on a graph of the R squared
value:
x<-rnorm(10)
y<-rnorm(10)
plot(x,y, main=paste(expression(R^2)," = ",round(summary(lm(y~
x))$r.squared, digits=3), sep=""))
I've read various other posts that say expression needs to be taken outside
the paste, but I can't seem to get it work as the following fails
plot(x,y, main=expression(paste("R^2"," = ",round(summary(lm(y~
x))$r.squared, digits=3), sep="")))
I tried it with title() and didn't get much further either.
Hmmm, any ideas what am I missing?
Thanks
Paul
--
View this message in context: http://n4.nabble.com/Paste-expression-in-graph-title-tp1289272p1289272.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list