[Rd] Difference between is(<<arg>>, "ANY") and extends(<<arg>>, "ANY")

Patrick Aboyoun paboyoun at fhcrc.org
Tue Sep 8 21:21:48 CEST 2009


Forgive the multiple posts, but I am resending a issue under a new 
subject so it doesn't get lost. There is inconsistent behavior between 
is and extends for class ANY. All classes (even non-existent ones) 
extend ANY according to methods::extends, but only S4 objects are of 
class ANY according to methods::is. This could be reconciled if is() 
checked if methods:::.identC(class2, "ANY") before it performed an 
S3Case test.

 > is(factor(), "ANY")
[1] FALSE
 > extends("factor", "ANY")
[1] TRUE
 > is(lm(I(1:10) ~ rnorm(10)), "ANY")
[1] FALSE
 > extends("lm", "ANY")
[1] TRUE
 > sessionInfo()
R version 2.10.0 Under development (unstable) (2009-09-07 r49613)
i386-apple-darwin9.8.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


Patrick



More information about the R-devel mailing list