[R] legend + expression

Pedro Mardones mardones.p at gmail.com
Fri Jun 8 23:27:44 CEST 2007


Dear all;

A simple? question.

I'm having a problem with a math expression in the legend of a plot
and I haven't found the way to get this to work, so any help will be
appreciate. Basically I want to include in the plot is the R-squared
and its numerical value, so I tried this:

R2c<-0.82879 # R-squared of calibration model
plot(1:10,1:10)
legend("topleft", legend=c(expression(R[c]^2==format(R2c,nsmall=2))))

Thanks for any hint

PM



More information about the R-help mailing list