[R] Catenating strings involving plotmath symbols.
Rolf Turner
rolf.turner at xtra.co.nz
Sat May 19 06:17:42 CEST 2012
In the context in which I am actually working it is necessary for
me to build parts of a text string to place on a plot in two separate
stages.
The following toy example illustrates what I am trying to do:
L1 <- substitute(list(paste("Bias in ", gamma,", ")))
L2 <- substitute(list(beta==b0),list(b0=300))
plot(1:10,main=L1) # Works fine.
plot(1:10,main=L2) # Works fine.
But what I want is the catenation of the strings contained in L1 and L2.
I thought that I might just be able to catenate them using c(), as in
plot(1:10,main=c(L1,L2))
but this just gives me the "L1" title, and L2 gets ignored.
Is there any way to accomplish my goal?
(Please don't tell me how to build a single string to use as a title;
I know how to do that. I need to be able to build two separate
strings and then combine them somehow.)
It seems to me that it should be do-able, but I have no idea where
or how to look for the appropriate incantation. Googling around,
I found lots of stuff on how to catenate vectors or paste together
"ordinary" text strings, but nothing on how to catenate mathematical
expressions.
Can anyone help me out?
cheers,
Rolf Turner
More information about the R-help
mailing list