Jacob Kasper wrote: > I know that this has been revisited over and over, yet I cannot figure out > how to solve this case of superscript troubles... > I would like the 2 in r2 to be superscript, yet I am pasting text before and > after it. I have tried several variations but have not solved this yet, any > suggestions? > > legend (bty = > "n","topright",paste("r2=",round(summary(lat_x)$r.squared,digits=3),", > P=",round(coefficients(summary(lat_x))[2,4], digits=3))) > Thank you > Jacob
You want the whole thing to be an expression. To insert values, bquote() is your friend. Something like this legend(bty="n", "topright", bquote(r^2 == .(round(summary(lat_x)$r.squared,digits=3) * "," * P == .(round(coefficients(summary(lat_x))[2,4], digits=3) ) ) (untested, if you want us to test, give us a reproducible example...) -- O__ ---- Peter Dalgaard Ă˜ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalga...@biostat.ku.dk) FAX: (+45) 35327907 ______________________________________________ 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.