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(names, p, collapse = "")
     parse(text = txt)
    }

Tests:
names <- c('R', 'P', 'K', 'alpha')
vals <- c(13.35, 2.53, 4.06, 0.0072)

# Different length inputs
vars <- c('beta', 'K[m]')
pars <- c(12, 0.6)

plot(c(0, 2), c(0, 2))
text(0, 1, parText(names, vals), adj = 0)
text(0, 0.5, parText(vars, pars))
title(parText(vars, pars))

Does that work?
Dennis




On Tue, Feb 2, 2010 at 8:44 AM, dkStevens <david.stevens@usu.edu> wrote:

>
> 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.007187'),pos=4)
>
> and the title was produced by
>
>
>
> expr<-bquote(italic(.(pNames[1]))==.(vparams[1])~","~.((pNames[2]))==.(vparams[2]))
>   plot(1,1,main=expr)
>
> in which pNames is a vector of character c("R","P[m]",...) and vparams is a
> vector of characters representing the values with the # of digits limited
> to
> 4. What I'm struggling with is to get the pNames recognized as objects
> similar to those in the expression above, but using variables rather than
> explicitly.
>
> In addition, is is to all go into a function to build the expression for
> varying numbers of elements (e.g. maybe just R = or P[m] =, both, or even
> more. The return from this function would be the expr that goes into a
> text(... command or,as Eik used, a main= plot parameter.
>
> http://n4.nabble.com/file/n1460088/help.png
>
>
> --
> View this message in context:
> http://n4.nabble.com/character-variables-in-substitute-tp1459566p1460088.html
> Sent from the R help mailing list archive at Nabble.com.
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]

