Skip to content
Prev 295030 / 398506 Next

Names of Greek letters stored as character strings; plotmath.

... and here is another incantation that may be  informative.

xnm<- as.name("gamma')  ## This does the parsing
plot(0, xlab =bquote(.(xnm))

The initial puzzle is that if you just set
xnm <- "gamma"

bquote will insert the string "gamma" rather than the symbol. After
all, that's what plotmath sees for xnm. So the key is telling plotmath
that it's a symbol, not a string. This can either be done before, as
above, or inline, as you and Gabor showed. Unsurprisingly. this also
does it, since as.name() is doing the parsing:

xnm <- "gamma"
 plot(0,xlab=bquote(.(as.name(xnm))))

AND we are adhering to Thomas's dictum: bquote is a wrapper for
substitute(), which is what he recommends as the preferable
alternative to eval(parse(...)) . But, heck -- all such software
principles are just guidelines. Whatever works (robustly).

HTH.

Cheers,
Bert

On Sat, May 19, 2012 at 3:17 AM, Gabor Grothendieck
<ggrothendieck at gmail.com> wrote:

  
    

Thread (18 messages)

Rolf Turner Names of Greek letters stored as character strings; plotmath. May 18 Gabor Grothendieck Names of Greek letters stored as character strings; plotmath. May 19 Bert Gunter Names of Greek letters stored as character strings; plotmath. May 19 Bert Gunter Names of Greek letters stored as character strings; plotmath. May 19 William Dunlap Names of Greek letters stored as character strings; plotmath. May 19 Paul Johnson Names of Greek letters stored as character strings; plotmath. May 19 Gabor Grothendieck Names of Greek letters stored as character strings; plotmath. May 19 William Dunlap Names of Greek letters stored as character strings; plotmath. May 19 Rolf Turner Names of Greek letters stored as character strings; plotmath. May 19 Robert Baer Names of Greek letters stored as character strings; plotmath. May 20 Rolf Turner Names of Greek letters stored as character strings; plotmath. May 20 Duncan Murdoch Names of Greek letters stored as character strings; plotmath. May 20 Bert Gunter Names of Greek letters stored as character strings; plotmath. May 20 Joshua Wiley Names of Greek letters stored as character strings; plotmath. May 20 Duncan Murdoch Names of Greek letters stored as character strings; plotmath. May 20 Peter Dalgaard Names of Greek letters stored as character strings; plotmath. May 21 William Dunlap Names of Greek letters stored as character strings; plotmath. May 21 Bert Gunter Names of Greek letters stored as character strings; plotmath. May 21