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


Thanks to both of you. I noted that my example was over-simplified. Looks like I need to correct the environment when nested in a function, but I have
to catch the last bus now.

Dieter


plotExp = function(what) {
 plot.new()
 lab =expression(paste("Estimated ", t[50]," from tgv"))
 text(0.5,0.5,lab)
 # Should look the same as above. Looks like I need a substitute....
 lab =bquote(paste("Estimated ", t[50]," from ",.(what))) ##<<need
environment
 text(0.5,0.2,lab)
}
plotExp(what)


Hope you caught the bus. Doesn't appear that an environment is needed if you don't add the paste() operation:

what= "tgv"
plotExp <- function(what) {
 plot.new()
 lab =expression(paste("Estimated ", t[50]," from tgv"))
 text(0.5,0.5,lab)
  lab =bquote(Estimated~t[50]~ from ~.(what) ) ;  text(0.5,0.2,lab)
   }
plot(what)

Furthermore I could not see from what infirmities the first version suffered.


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