Dear R-users, In the following example, I would like to see my ylabel as: "beta[3] * x[3] + epsilon" (where beta and epsilon are replaced by their mathematical symbols). Please advise. Thanks. Nitin i <- 3 ee <- expression(beta[i] * x[i] + epsilon) xyplot(1:10~ 11:20, ylab = parse(text=ee) ) ____________________________________________________________________________________ 8:00? 8:25? 8:40? Find a flick in no time
On Wed, 6 Jun 2007, Nitin Jain wrote:> Dear R-users, > > In the following example, I would like to see my ylabel as: "beta[3] * > x[3] + epsilon" (where beta and epsilon are replaced by their > mathematical symbols). > > Please advise.?plotmath ?bquote example(plotmath)> > Thanks. > > Nitin > > > i <- 3 > > ee <- expression(beta[i] * x[i] + epsilon) > > xyplot(1:10~ 11:20, > ylab = parse(text=ee) > ) > > > > > > ____________________________________________________________________________________ > 8:00? 8:25? 8:40? Find a flick in no time > > ______________________________________________ > R-help at stat.math.ethz.ch 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. >Charles C. Berry (858) 534-2098 Dept of Family/Preventive Medicine E mailto:cberry at tajo.ucsd.edu UC San Diego http://biostat.ucsd.edu/~cberry/ La Jolla, San Diego 92093-0901
Try this: library(lattice) x <- 1:10 i <- 3 xlab <- as.expression(substitute(beta[i] * x[i] + epsilon, list(i = i))) xyplot(x ~ x, xlab = xlab) On 6/6/07, Nitin Jain <nj7w at yahoo.com> wrote:> Dear R-users, > > In the following example, I would like to see my ylabel as: "beta[3] * x[3] + epsilon" (where beta and epsilon are replaced by their mathematical symbols). > > Please advise. > > Thanks. > > Nitin > > > i <- 3 > > ee <- expression(beta[i] * x[i] + epsilon) > > xyplot(1:10~ 11:20, > ylab = parse(text=ee) > ) > > > > > > ____________________________________________________________________________________ > 8:00? 8:25? 8:40? Find a flick in no time > > ______________________________________________ > R-help at stat.math.ethz.ch 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. >