Tamas Papp wrote:

Hi,

I need a list of expression of the form expression(b[i]), where i is a
running index.  So for example, if i <- -1:2, I would like to have a
list equivalent to

list(expression(b[-1]), expression(b[0]), expression(b[1]), expression(b[2]))

"i" might be a character vector (like c("f", "g", "h"))

Could somebody help me out by writing a function that produces the
list above for a given string in place of "b" and a vector of subscripts?

Sorry if this has been discussed before, I tried searching the
archives but "expression" as a keyword gives too many results on
different subjects.

Thanks,

Tamas


For example:


lapply(as.double(-1:2), function(x) substitute(b[i], i = list(i=x)))

Uwe Ligges

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to