[R] character variables in substitute()

dkStevens david.stevens at usu.edu
Tue Feb 2 06:50:36 CET 2010


In trying to create a plotmath expression for plot labeling, such as 

R = 6, beta = 15

where I want beta to be the Greek beta and, possibly, R in italics (like one
would get in an explicit expression. The reason for this is that I want to
write a string builder function that takes vectors of variable names and
their values and return a plotmath expression for labeling a plot. One
approach I tried is

pname = c("R","beta")
params = c(6,15)
substitute(p == v,list(p = pname[i],v = format(params[i],digits=4))

but this just copies the character strings in pname into the expression. Can
anyone help me do what I want? How would I manage passing the resulting
string back to the calling routine? Any help will be much appreciated.


-- 
View this message in context: http://n4.nabble.com/character-variables-in-substitute-tp1459566p1459566.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list