[Rd] Creating ref class with same name as S4 class results in error

Gabor Grothendieck ggrothendieck at gmail.com
Wed Jan 30 00:13:06 CET 2013


It seems that if one overwrites an S4 class with a Reference Class of
the same name that one gets an error in the situation below. I would
have expected that the Reference Class would replace the S4 class in
such a way that one could now use the Reference Class.

> A <- setClass("A", representation(x = "ANY"))
> x <- A()
> A <- setRefClass("A", fields = "a")
> x <- A$new(a = 1)
Error in initialize(value, ...) : invalid names for slots of class "A": a
> R.version.string
[1] "R version 2.15.2 Patched (2013-01-17 r61672)"

I got the same result on:

 "R Under development (unstable) (2013-01-25 r61745)"

Both were run under Windows 8 64 bit.

--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



More information about the R-devel mailing list