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,


______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to