R-beta: S Compatibility (again)
rgentlem at stat.auckland.ac.nz
Tue Apr 14 01:50:43 CEST 1998
I too have been away enjoying an undeserved but fun Easter break.
I just wanted to try to clarify one point regarding functions:
as.function does not exist in R because you really shouldn't turn
things that aren't functions in to them. In S people are really
crossing a boundary that it is very important not to cross. That
is the difference between the implementation of an object and
the object. The fact that functions are implemented as vectors
is nice but not as far as I can tell NOT part of the language. Accessing
them as if they were functions is possible but not good style.
Will they be arrays in S4?
You can access all the parts of a function in R through the functions
args, body and environment. Writing a similar set
of functions for Splus would then give you the level of abstraction that
you really want (honest, trust me) and its trivial.
x <- x * x
It should be possible to write a body<- function that let you assign a new
body (given lexical scope this can be absolutely disasterous). There is
already an environment<- function. Probably we need arguments (since args
returns a function rather than the list of args). If you really want it
let me know and I'll whip up something that does this.....
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