[Rd] [Sender Not Verified] is(x,"ANY") is FALSE

Michael Lawrence (MICHAFLA) |@wrence@m|ch@e| @end|ng |rom gene@com
Wed May 3 01:01:41 CEST 2023


Hi,

This does seem to be a bug in is(); I'll take a look. I'm curious
about what stopped you from using setOldClass(), since that seems to
be the most appropriate solution.

Michael

On Tue, May 2, 2023 at 2:59 PM Russell Almond <russell using ralmond.net> wrote:
>
> I’m somewhat puzzled by the following bit of code on R 4.2.3 (also R 4.2.2)
>
> > df <- data.frame(x=1:3)
> > is (df,"ANY")
> [1] FALSE
>
> This seem to be false when the first argument is any S3 class, while I would think that “ANY” would be true for S3, S4 and reference classes, as well as primitive types.
>
> This also seems to be a regression, as code that was previously working no longer works.
>
>
> A little more context on my use.
>
> I’m defining a slot for a reference class using a type union,
> setClass(“MongoDB”,c(“NULL”,”ANY”))
>
> [I should be using setOldClass(“mongo”) here, but I was having trouble promoting the S3 “mongo” class I was getting from the library.]
>
> Then when I try to set the corresopnding slot I’m getting an error, because “mongo” is not of type MongoDB (even through that is a class union which contains “ANY”).
>
> I can work around the problem by setting the slot to type “ANY”, but then I loose the documentation that the intention is that it should a mongo database connection.
>
> Did I miss something here?  Or is this an unintended consequence of some other change?
>
> Thanks,
>   —Russell Almond
>
>
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



-- 
Michael Lawrence
Senior Principal Scientist, Director of Data Science and Statistical Computing
Genentech, A Member of the Roche Group
Office +1 (650) 225-7760
michafla using gene.com

Join Genentech on LinkedIn | Twitter | Facebook | Instagram | YouTube



More information about the R-devel mailing list