[R] Catenating expressions in plotmath().

Rolf Turner rolf at math.unb.ca
Tue Mar 19 23:23:19 CET 2002

I want to do something like produce a plot title of the form

	``Sample size n = 42; critical value k_0 = 17.''

where the ``n'' is to be in a maths font and ``k_0'' indicates
that the 0 is a subscript.  (A la LaTeX.)

But the values ``42'' and ``17'' are to be substituted in from the
numeric values of R objects.

After a bit of struggle I found that

> nn <- 42
> kk <- 17
> plot(1:10,1:10,

gets pretty close to what I want.  But how do I fold in the text strings
``Sample size'', "; critical value", and "." (at the end)?

Is this simply impossible?

I'd like to be able to do something like form

	e1 <- substitute(list(n==nsub),list(nsub==nn))
	e2 <- substitute(list(k[0]==ksub),list(ksub==kk))

and then somehow ``paste'' together "Sample size", e1, "; critical value",
e2, and ".".

I've tried every possible permutation (I think) of expression(), paste(),
and substitute(), and none seem to work.

Is it a hopeless case?


						Rolf Turner
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list