Superscript R squared for legend
legend, r
Solution
It will work if you combine `bquote` and `as.expression`:
plot(1:10)
legend(2, 10, c(as.expression(bquote("BW (MPE = 3%," ~ R^2 ~ "= 0.77)")),
as.expression(bquote("MY (MPE = 5%," ~ R^2 ~ "= 0.80)"))),
pch=c(2,3))
Problem
I want to write a R-squared term for my legend but I do not know how. Could someone help me please? My legend syntax is: ``` legend(2,10, c("BW (MPE=3%, R-squared=0.77)", "MY (MPE=5%, R-squared=0.80)", pch=c(2,3)) ``` I would liek to express R-squared as R2 as we normally have in the text.