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.
This is less complex than using
c( as.expression ( bquote...
multiple times:It is useful to understand that the
expression
function is really a way to make lists of expressions and that commas are then reserved as separators for that process. This means you cannot have a "naked" comma in something you want to be inside one of the distinct elements. The commas immediately after the%
-signs are protected from parsing by the quotes. This could fully plotmath()-ified with:That way the only character needing special attention is the '%'-sign which plotmath() uses to delimit its specials.
It will work if you combine
bquote
andas.expression
: