[R] Private methods
Austin, Matt
maustin at amgen.com
Sat Aug 14 03:34:22 CEST 2004
.class1 is an 'internal' method in the namespace of the package 'methods'.
It can be accessed with the ::: operator. A good start for documentation
may be Vol 3/1 of R-News.
>methods:::.class1
function (x)
class(x)[[1]]
<environment: namespace:methods>
--Matt
-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch]On Behalf Of Matthew Walker
Sent: Friday, August 13, 2004 17:19 PM
To: r-help at stat.math.ethz.ch
Subject: [R] Private methods
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
______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
More information about the R-help
mailing list