Names of Greek letters stored as character strings; plotmath.
On Sat, May 19, 2012 at 1:18 AM, Rolf Turner <rolf.turner at xtra.co.nz> wrote:
I had such good luck with my previous question to r-help, (a few minutes ago) that I thought I would try again with the following query:
Suppose I have ? ?xNm <- "gamma" I would like to be able to do ? ?plot(1:10,xlab = <something involving xNm">) and get the x axis label to be the Greek letter gamma (rather than the literal text string "gamma"). Is this possible? ?I've messed around with substitute() and bquote() and got nowhere.
Then, just before clicking on "Send", I had one more thimk, and blow me down, I got something that worked: plot(1:10,xlab=eval(expression(parse(text=xNm))))
That can be shortened to: plot(0, xlab = parse(text = xNm))
Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com