[R] A programming puzzler
tlumley at u.washington.edu
Mon Apr 9 01:57:48 CEST 2001
On Sat, 7 Apr 2001 fharrell at virginia.edu wrote:
> I am trying to replicate part of the function of the
> S-Plus terms.inner function. I don't need an entire
> model terms object but R expressions or character
> strings containing the innermost variable name given
> a vector of character strings or expressions. Here
> are some example inputs that each should result in the
> string or expression "x":
> x; x^2; g(x); h(g(x)); h(g(x^3)); j(h(g(pmin(x,3))))
> To anyone who meets the challenge, thanks!
You're looking for all.vars(). It works on a formula, terms, or expression
 "x" "y"
Thomas Lumley Asst. Professor, Biostatistics
tlumley at u.washington.edu University of Washington, Seattle
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help