[R-pkg-devel] New 'extptr.as.ref' argument in identical() causing check failures

Andrew Plowright p|owr|ght@@ndrew @end|ng |rom gm@||@com
Wed Feb 2 06:16:49 CET 2022


Great example, that makes perfect sense.

I'll just drop the identical method. Easy fix!

Thanks,
Andrew

On Tue, Feb 1, 2022 at 6:57 PM Simon Urbanek <simon.urbanek using r-project.org>
wrote:

>
>
> > On Feb 2, 2022, at 3:01 PM, Andrew Plowright <plowright.andrew using gmail.com>
> wrote:
> >
> > Hi Simon,
> >
> > Thanks for your reply. I guess I could use == instead. What I want is a
> method for checking if two S4 class objects are the same. I thought that ==
> was strictly meant for atomic and list types?
> >
>
>
> identical() already checks that two objects S4 are the same - so if that's
> what you want, then you don't need to do anything, R provides.
>
> I assumed you want to decide if two objects are semantically equal even if
> the two objects are not identical, but can still be equal - let's say
> because you include some additional information in the object that you want
> to skip when deciding equivalence. In that case == is the way to go. If
> your object does not have vector semantics, then you just return a scalar,
> e.g. let's take an example from a class you're familiar with:
>
> WGS84 and EPSG: 4326 are the same CRS:
>
> > st_crs("WGS84") == st_crs(4326)
> [1] TRUE
>
> but the objects are not necessarily identical:
>
> > identical(st_crs("WGS84"), st_crs(4326))
> [1] FALSE
>
> Cheers,
> Simon
>
>
>
> > Andrew
> >
> > On Tue, Feb 1, 2022 at 4:45 PM Simon Urbanek <
> simon.urbanek using r-project.org> wrote:
> > Andrew,
> >
> > you should not re-define identical, it is not a semantic operation and
> does NOT test equality. Did you mean to write a `==` method instead?
> >
> > Cheers,
> > Simon
> >
> >
> >
> > > On Feb 2, 2022, at 9:20 AM, Andrew Plowright <
> plowright.andrew using gmail.com> wrote:
> > >
> > > Hello, I have an 'identical()' method in my library
> > >
> > >
> https://github.com/andrew-plowright/TileManager/blob/0f213a6bcce4bc4b6d0f5e6672660409e09c22c5/R/tileScheme-methods.R#L198
> > >
> > > I recently started getting a warning message regarding a new
> > > 'extptr.as.ref' argument that was added to R-devel in December. When
> > > running devtools::check_rhub() I get:
> > >
> > > ```
> > > * checking for code/documentation mismatches ... WARNING
> > > identical
> > >                 TRUE, ignore.bytecode = TRUE, ignore.environment =
> > >                 FALSE, ignore.srcref = TRUE, extptr.as.ref = FALSE)
> > >  Code: function(x, y, num.eq = TRUE, single.NA = TRUE, attrib.as.set =
> > > Codoc mismatches from documentation object 'identical':
> > >  Docs: function(x, y, num.eq = TRUE, single.NA = TRUE, attrib.as.set =
> > >                 TRUE, ignore.bytecode = TRUE, ignore.environment =
> > >                 FALSE, ignore.srcref = TRUE)
> > >  Argument names in code not in docs:
> > >    extptr.as.ref
> > > ```
> > >
> > > I tried adding the 'extptr.as.ref' argument to my documentation, but
> now I
> > > get a new warning:
> > >
> > > ```
> > >  Documented arguments not in \usage in documentation object
> 'identical':
> > >
> > >    'extptr.as.ref'
> > >  Functions with \usage entries need to have the appropriate \alias
> > >  entries, and all their arguments documented.
> > >  The \usage entries must correspond to syntactically valid R code.
> > >  See chapter 'Writing R documentation files' in the 'Writing R
> > >  Extensions' manual.
> > > ```
> > >
> > > So it seems that a warning is being generated both with or without the
> > > extptr.as.ref in my documentation. Any help would be appreciated,
> thanks!
> > >
> > > Andrew
> > >
> > >       [[alternative HTML version deleted]]
> > >
> > > ______________________________________________
> > > R-package-devel using r-project.org mailing list
> > > https://stat.ethz.ch/mailman/listinfo/r-package-devel
> > >
> >
>
>

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list