From |@wrence@m|ch@e| @end|ng |rom gene@com  Wed May  3 01:01:41 2023
From: |@wrence@m|ch@e| @end|ng |rom gene@com (Michael Lawrence (MICHAFLA))
Date: Tue, 2 May 2023 16:01:41 -0700
Subject: [Rd] [Sender Not Verified]  is(x,"ANY") is FALSE
In-Reply-To: <7BAB2953-CF25-484C-925F-CD460AC90A23@ralmond.net>
References: <7BAB2953-CF25-484C-925F-CD460AC90A23@ralmond.net>
Message-ID: <CAOQ5Nyes-9gU1=efynk66nEbZc0XvaGVhgky_4o79g9iD6+1mA@mail.gmail.com>

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 at 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 at 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 at gene.com

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



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