[R] A programming puzzler

fharrell@virginia.edu fharrell at virginia.edu
Sat Apr 7 20:04:51 CEST 2001

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!

Frank E Harrell Jr              Prof. of Biostatistics & Statistics
Div. of Biostatistics & Epidem. Dept. of Health Evaluation Sciences
U. Virginia School of Medicine  http://hesweb1.med.virginia.edu/biostat
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 mailing list