Message-ID: <3EF2B6F0.9030503@statistik.uni-dortmund.de>
Date: 2003-06-20T07:25:36Z
From: Uwe Ligges
Subject: combining mathematical notation and value substitution
In-Reply-To: <Pine.LNX.4.44.0306200240580.25336-100000@Chrestomanci>
Faheem Mitha wrote:
> Dear People,
>
> I need to make a label which both contains math notation as well as
> substitutes a value for an object. In the following label, len and theta
> are one dim variables, and I am substituting their values appropriately.
> This label looks fine except that I want the greek symbol for theta to
> appear instead of the word `theta'. How can I do so most easily? I don't
> understand the underlying mechanisms well enough to work it out for
> myself. Thanks in advance.
>
> Please cc me. I'm not subscribed to the list.
>
> Faheem.
>
> main=paste("Monotonic Multigamma run (n=",
> deparse(substitute(len)),", ",
> expression(theta),"=", deparse(substitute(theta)),").")
No, it won't work that way, because you have to specify an S expression
in order to get mathematical annotation. An expression within paste()
will be converted to a character string.
What you ca do is the other way round:
t1 <- theta # you cannot use theta as variable and math. symbol
plot(1:10, main =
substitute("Monotonic Multigamma run (" * n == len * ", " *
theta == t1 * ").", list(len = len, t1 = t1)))
See also ?plotmath or that small article in R News:
Ligges (2002): R Help Desk: Automation of Mathematical Annotation in
Plots. R News 2(3), 32-34.
Uwe Ligges