Re: [R] character variables in substitute()

2010-02-02 Thread dkStevens
Well - I am impressed. Between Gabor and Dennis, I now have three for the price of one - for titles, text lines, and legends. Guys, thanks so much - I never would have gotten there without your help. This forum has already paid for itself. Regards, David -- View this message in context: http:/

Re: [R] character variables in substitute()

2010-02-02 Thread Dennis Murphy
Hi: Taking David's and Gabor's contributions, I came up with a function that I hope satisfies David's needs: parText <- function(names, pars) { p1 <- paste("* '= ", pars[-length(pars)], ", '*", sep = "") p2 <- paste("* '= ", pars[length(pars)], "'") p <- c(p1, p2) txt <- paste

Re: [R] character variables in substitute()

2010-02-02 Thread Gabor Grothendieck
Try this: leg <- function(pNames, vparams) parse(text = paste(pNames, vparams, sep = "==")) plot(0, main = leg("Sigma", 3.2)) legend("topleft", legend = leg(c("alpha[beta]", "delta"), 1:2)) On Tue, Feb 2, 2010 at 11:44 AM, dkStevens wrote: > > This is an interesting approach but it doesn't quit

Re: [R] character variables in substitute()

2010-02-02 Thread dkStevens
This is an interesting approach but it doesn't quite get what I want. The sample below is what I'm looking for where Eik's Title is compared with the text line within the plot. My text line was produced by the explicit text(0.6,1.2,expression(R *'= 13.35, ' *P[m] *'= 2.531, ' *alpha[r] *'= 0.00

Re: [R] character variables in substitute()

2010-02-02 Thread Dennis Murphy
That's the trick, Eik! Nice job. To return to the problem I was struggling with, it works with the following incantation: names <- c('R', 'P', 'k', 'alpha') vals <- c(13.34859, 2.53071, 4.06000, 0.00719) expr <- bquote(.(names[1])==.(vals[1])~", "~.(as.name(names[2]))[m]==.(vals[2])~", "

Re: [R] character variables in substitute()

2010-02-02 Thread Eik Vettorazzi
Hi David, there is a solution using bquote instead of substitute expr<-bquote(italic(.(pname[1]))==.(params[1])~", "~.(as.name(pname[2]))==.(params[2])) plot(1,1,main=expr) hth. dkStevens schrieb: In trying to create a plotmath expression for plot labeling, such as R = 6, beta = 15 where

Re: [R] character variables in substitute()

2010-02-02 Thread Dennis Murphy
Hi: I played around with this earlier, but had only limited success. This is what I got; perhaps others can embellish this with more efficient (and correct) code. I couldn't get more than one expression in a line without overplotting. Here's an example: plot(c(0, 1), c(0, 1)) text(0.5, 0.5, expr

[R] character variables in substitute()

2010-02-01 Thread dkStevens
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 var