Printing mathematical expressions in R
Short answer: Use the command expression().
For a list of mathematical symbols and ways to display them, check ?plotmath.
Run demo(plotmath) to see the formatting syntax (in gray) and the resulting output (in black).
Example usage:
plot(c(1,2,3),c(1,2,3),xlab=expression(paste(x[i],y^2)))
Note that the following will give you an error: Error: unexpected symbol in . . .. R needs the paste command to “juxtapose” the symbols, as above.
Gives an error:
plot(c(1,2,3),c(1,2,3),xlab=expression(x[i]y^2))
Tags: mathematical expressions, paste