[EMAIL PROTECTED] wrote: > The first four lines of code below work as normal. The fifth thorows > an error: "Error in paste(theta[1], "=", 5) : object "theta" not found" > > > x=rnorm(1000); > bob=density(x); > topp=5; > plot(bob,xlab="", ylab="", > main=substitute(paste(theta[1],"=",topp),list(topp=topp)), type="l"); > plot(bob$y~bob$x,xlab="", ylab="", > main=substitute(paste(theta[1],"=",topp),list(topp=topp)), type="l"); > I'm not sure this is a bug, but if it is, it's in graphics:::plot.formula, not in substitute. The problem is that substitute returns an unevaluated call, and plot.formula tries to evaluate it. You can avoid the bug by wrapping the substitute call in as.expression.
The docs for plotmath say that it requires an expression, but "in most cases" language objects will be coerced to one: it appears this is one of the cases where that is not true. Duncan Murdoch > > Note that theta is not defined anywhere: > > ls() > [1] "bob" "dline" "dplot" "dpt" "less" "lesseq" > [7] "more" "moreeq" "peak" "peakline" "peakplot" "pop" > [13] "topp" "x" > > > Version: > platform = i386-apple-darwin8.10.1 > arch = i386 > os = darwin8.10.1 > system = i386, darwin8.10.1 > status = > major = 2 > minor = 6.1 > year = 2007 > month = 11 > day = 26 > svn rev = 43537 > language = R > version.string = R version 2.6.1 (2007-11-26) > > Locale: > C > > Search Path: > .GlobalEnv, package:stats, package:graphics, package:grDevices, > package:utils, package:datasets, package:methods, > > ____________ > > Jeffrey Ross-Ibarra > email: [EMAIL PROTECTED] > web: rossibarra.googlepages.com > Dept. Ecology and Evolutionary Biology > University of California > Irvine, Ca. 92697 > > ______________________________________________ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel