On Sat, May 19, 2012 at 1:18 AM, Rolf Turner <rolf.tur...@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

______________________________________________
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