[R] Private methods

Matthew Walker m.g.walker at massey.ac.nz
Sat Aug 14 02:19:08 CEST 2004


Hi,

I'm trying to understand R's object oriented abilities.

I have read (in a very recent email to r-help) that R's methods package 
does not support private methods.  However, I also looked at the source 
for the function "is":

 > is
function (object, class2)
{
    cl <- .class1(object)
    if (missing(class2))
        return(extends(cl))
    if (.identC(cl, class2) || .identC(class2, "ANY"))
        return(TRUE)
    ...

The first line of the function, the assignment to cl, seems to call a 
function called ".class1".  I was unable to see the source for ".class1":

 > .class1
Error: Object ".class1" not found

It seems to me that either (a) I don't understand what I'm doing, or (b) 
".class1" is a very private method.  The help system finds nothing about 
".class1". 

Could someone please help me to understand this.  Most helpful of all 
would be pointers on where I could find more information.  (So far I 
have found only two documents on R's object oriented abilities:  "A 
guide to using S4 Objects" and "A draft of the R language definition".)

Thanks,

Matthew




More information about the R-help mailing list