[Rd] Base "Object" class to use in S4 slot specification

Patrick Aboyoun paboyoun at fhcrc.org
Mon Aug 17 19:52:13 CEST 2009


I am looking to have slot in an S4 class definition that can take any 
(S3 or S4) object. The ANY class seemed to be a good candidate, but the 
is() function definition performs an S3Case test before checking if 
methods:::.identC(class2, "ANY"). The result is the is() function does 
not consider various S3 objects to be of class ANY.

 > is(factor(), "ANY")
[1] FALSE
 > is(lm(I(1:10) ~ rnorm(10)), "ANY")
[1] FALSE
 > sessionInfo()
R version 2.10.0 Under development (unstable) (2009-08-05 r49073)
i386-apple-darwin9.7.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base    

What is the recommended base "Object" class I should define my slot to 
be so it can accept any object?


Patrick



More information about the R-devel mailing list