[R] function design

Michaell Taylor pols1oh at bestweb.net
Mon Mar 18 23:55:40 CET 2002

I have a, no doubt, simple question. I wish to write a function such

a <- 9
b <- 10
changer _ function(x,y) { if (y>x){ x <<- Y+1}}

Of course there are easier ways to accomplish the task above, but I am
more interested in how to have the "x <<- Y+1" part of the function to
change x in place for purposes of a much larger function.

I have been wrestling with various forms of the assign, as.name,
deparse, substitute (by now you probably sense a air of desperation)
commands, and permuations thereof.

These variables will be in a detached data.frame (not shown here).

Thanks for your time.


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