Latex and variables in plot label in R?

Viewed 6073

How do I use variables in Latex expressions in R?

For example:

plot(X, Y, main=expression(R^2))

Will put R with a nice superscripted 2 as main title.

But let's say I want it to say 'R^2: 0.5', with 0.5 coming from a R variable. How do I do that?

4 Answers
Related