[R] converting a string to an element in a function call
Thomas Lumley
thomas at biostat.washington.edu
Wed Jun 21 21:38:05 CEST 2000
On Wed, 21 Jun 2000, Adrian Vance Custer wrote:
> Hello everyone,
>
> The issue is that I pass a vector of strings to the function and want to use it
> as:
>
> update(.~.+ do.something.to.the.string(vector.argument.of.strings[i])
> or in the code below
> update(.~.+unknown(facvec[i]))
There's probably a way to do this more directly, but you can use
substitute() to update the formula.
update(model,substitute(.~.+new,list(new=as.name(facvec[i]))))
-thomas
Thomas Lumley
Assistant Professor, Biostatistics
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
mailing list