[R] expression with running index

Tamas Papp tpapp at axelero.hu
Sun Apr 25 20:13:14 CEST 2004


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

-- 
Tamás K. Papp
E-mail: tpapp at axelero.hu
Please try to send only (latin-2) plain text, not HTML or other garbage.




More information about the R-help mailing list