[R] Double expressions in plot labels

Marcin Kozak nyggus at gmail.com
Mon Jan 23 04:39:37 CET 2012


Hi all,

I wanted to do something of this sort:

library(lattice)
label <- expression(alpha)
xx <- substitute(expression(lab %+-% type), list(lab = label, type = " type"))
stripplot(Species ~ jitter(Petal.Length), iris, ylab = xx, horizontal=T)

(The example plot itself does not make much sense, but I need only to
construct the label.) Since I want to make it a general function, I
need to have both these expressions (the "lab" and "type" arguments
sometimes are and other times are not expressions, but I must assume
such a possibility). Unfortunately, the above code does not work, that
is, does not produce a label that should say "alpha +- type" [alpha in
Greek]. The first part (the alpha) is ignored at all. Any idea how to
do that?

I work with R 12.1, Windows 7.

Best wishes,
Marcin



More information about the R-help mailing list