[R] Object orientation?

Thomas Lumley tlumley at u.washington.edu
Wed Jan 24 17:34:19 CET 2001

On Wed, 24 Jan 2001, Yves Gauvreau wrote:
> Hi,
> I wonder how one could implement the following idea in R if it's possible of
> course. Say you have an object, lets call it MyO. I would like MyO to
> provides both properties and methods, encapsulation in OOP terms I think. I
> would like to access MyO properties (only) via functions like {get, let,
> set}.

> I know I could use super assign (<<-) but I think some say it's best
> avoided.

This is one of the acceptable uses of <<-, as shown in
demo(scoping).  <<- is useful for modifying a variable that you know
exists in the enclosing environment. Most of the problems come from people
trying to use it to modify things in a parent environment or in the global


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