[R] Math Expression and Variable Value in Title
Roger D. Peng
rpeng at jhsph.edu
Thu Jan 29 01:35:28 CET 2004
Use substitute()
n <- 20
plot(0, 0, main = substitute(paste(n[i], " = ", k), list(k = n)))
-roger
Wolfgang Viechtbauer wrote:
> Hello All,
>
> I am trying to put a math expression into a plot title and at the same
> time, I want a value in the title to depend on a variable that I set
> earlier.
>
> Simple Example:
>
> n <- 20
> plot(0, 0)
> title(expression(paste(n[i], " = ", n)))
>
> Obviously, I want "n_i = 20". How can I get that?
>
> Thanks in advance,
>
More information about the R-help
mailing list