hi, i'm trying to prepend some plain (i.e. unevalutated) text to a typographically evaluated R expression in a legend(...) call.
here's a working legend(...) call that is close to what i'd like (where x and y are returned from an lm(...) call): legend("topleft", legend = c(bquote(R^2 == .(summary(x)$r.squared)), bquote(R^2 == .(summary(y)$r.squared))), fill = c("blue", "red")) this evaluates the R^2 values for my x and y objects, then displays them in the plot legend with colored boxes adjacent to them. now the hard part (for me, at least :-/), i'd like to add some text (e.g. "data set 1" and "data set 2") to each line of the legend, right before the typographically-displayed R^2 == some_value text. basically, a legend that looks like so (with the expression part evaluated and typed out correctly): data set 1 R^2 == some_value data set 2 R^2 == some_other_value i've tried a seemingly countless number of paste/substitute/expression combinations, but cannot seem to get what i'd like. anyone know of a nice call to create these two strings to display on my plot? thanks for any help! -murat ______________________________________________ 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.