I am trying to put  an
R2 value with R2 formatted with a superscript 2 followed by "=" and the value : the first mtext prints the R2 correctly formatted but follows it with "=round(summary(mylm)$r.squared,3)))" as text the second prints "R^2 =" followed by the value of round(summary(mylm)$r.squared,3))).

how do I correctly write the expression to get formatted r2 followed by the value?




x=runif(10)
y=runif(10)
summary(mylm<-lm(y~x))
plot(x,y)
abline(mylm)
mtext(expression(paste(R^2,"=",round(summary(mylm)$r.squared,3))),1)
mtext(paste(expression(R^2),"=",round(summary(mylm)$r.squared,3)),3)



thanks

Nevil Amos

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to