On Aug 27, 2010, at 2:19 PM, Dieter Menne wrote:

Disclaimer: I have read plotmath, but maybe it's too late today:

How do I get the two labels to be the same:

plot.new()
lab =expression(paste("Estimated ", t[50]," from tgv"))
text(0.5,0.5,lab)
# Should look the same as above. I could not get the substitute right:
what = "tgv"
lab =expression(paste("Estimated ", t[50]," from ",what))
text(0.5,0.2,lab)

The problem with that method (I think) is that expression protects its arguments to some extent. The help page wording is that it is "special" and does not evaluate its arguments although you seem to have gotten the paste() function evaluated. Try:

plot.new()
lab <- expression(paste("Estimated ", t[50]," from tgv"))
text(0.5,0.5,lab)
# Should look the same as above. I could not get the substitute right:
what <- "tgv" ; expr <- paste("Estimated t[50] from ", what)
lab <- as.expression(expr)  # expression() does not satisfy
text(0.5,0.2,lab)

--
David Winsemius, MD
West Hartford, CT

______________________________________________
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.

Reply via email to