[R-pkg-devel] Needing rgeos from sf

Neal Richardson ne@|@p@r|ch@rd@on @end|ng |rom gm@||@com
Thu Jul 25 23:01:54 CEST 2019


A couple of ideas:

1. Both `sf` and `sp` packages Suggest rgdal and rgeos. If your
package were to Suggest them, the dependencies will be available for
CRAN checks, but they won't be available if they're only Suggested by
a package you Import.
2. Except sometimes when they are available. I've experienced
variability in this before, depending on which CRAN server you run on
and which other packages have recently been checked on it (I think
that's the reason). In your case, it could have something to do with
rgdal/rgeos availability on Windows, but the operating system might be
a red herring. Regardless, it looks like you've found a solution.

Neal


On Thu, Jul 25, 2019 at 1:49 PM Roy Mendelssohn - NOAA Federal via
R-package-devel <r-package-devel using r-project.org> wrote:
>
> Thanks,  actually have similar code for some other packages that must have been causing similar problems  (that part was from the original author,  I am now the maintainer).  Now I understand why he had something similar in the code.  There is a comment about Namespaces not being handled properly in those packages.
>
> Will try that.  I actually have rgdal and rgeos in Imports,  they were getting flagged in the CRAN nightly builds.  If I have them in that one statement,  that should take care of both issues I believe.
>
> But it would be nice to figure out why this is happening,  and only on Windows.  Sort of frustrating when you follow the guidelines but get failures,  but what also what is good about things like CRAN,  for whatever reason this will insure I work across platforms.
>
> -Roy
>
>
> > On Jul 25, 2019, at 12:56 PM, Duncan Murdoch <murdoch.duncan using gmail.com> wrote:
> >
> > On 25/07/2019 3:47 p.m., Roy Mendelssohn - NOAA Federal wrote:
> >> Okay I added rgeos but now it can't find rgdal.  as in:
> >>> Error: processing vignette 'using_plotdap.Rmd' failed with diagnostics:
> >>> package 'rgdal' is not available
> >>> --- failed re-building 'using_plotdap.Rmd'
> >>>
> >> A question I asked before is if there is anyway to check that 'rgdal' and 'rgeos' are properly installed on the winbuider servers, as well as 'sf' and 'sp'?  'devtools::check()' on my mac produces no errors,  same with  'rhub' using Fedora,  but I get the same errors on 'rhub' using Windows.    So it appears to be a problem with Windows,  and again I am not calling these packages directly so I should not need to Import them.
> >
> > You're right, you shouldn't need to import them if you don't call them directly.  However, if some package that you do need requires them, then your build or checks will fail without them.
> >
> > It's probably getting tedious, but you could work around this as well, by figuring out what part of using_plotdap.Rmd needs rgdal, and wrapping that code in something like
> >
> > if (requireNamespace("rgdal")) {
> >  # code that needs it
> > }
> >
> > I think this will mean you need to add rgdal to the Suggests list for your package to avoid other warnings.
> >
> > Duncan Murdoch
> >
> >> Thanks,
> >> -Roy
> >>> On Jul 25, 2019, at 12:38 PM, Duncan Murdoch <murdoch.duncan using gmail.com> wrote:
> >>>
> >>> On 25/07/2019 3:21 p.m., Roy Mendelssohn - NOAA Federal via R-package-devel wrote:
> >>>> I have been testing a package for resubmission with bug fixes.  On the present CRAN builds I get:
> >>>>> Result: NOTE
> >>>>>     Namespaces in Imports field not imported from:
> >>>>>      ‘mapdata’ ‘maptools’ ‘plot3D’ ‘rgdal’ ‘rgeos’
> >>>>>      All declared Imports should be used.
> >>>> However,  if I remove rgeos from the imports I get from win builder:
> >>>>> Error in st_as_sfc.SpatialPolygons(sp::geometry(x), ...) :
> >>>>>      package rgeos required for finding out which hole belongs to which exterior ring
> >>>> Note that I am not calling 'rgeos',  either 'sf' or 'sp' is,  but does not appear to be properly importing all the need namespaces.
> >>>> Best way  to proceed?  Include rgeos in Import and get the Note,  or ????
> >>>
> >>> A simple workaround would be to add a function that calls something from rgeos just to satisfy the check, e.g.
> >>>
> >>> # Just to satisfy the checks...
> >>> dummy <- function() rgeos::getScale()
> >>>
> >>> I don't think there are warnings if dummy is never used or exported, but if there are, I think that's a pretty harmless call to make.
> >>>
> >>> Duncan Murdoch
> >> **********************
> >> "The contents of this message do not reflect any position of the U.S. Government or NOAA."
> >> **********************
> >> Roy Mendelssohn
> >> Supervisory Operations Research Analyst
> >> NOAA/NMFS
> >> Environmental Research Division
> >> Southwest Fisheries Science Center
> >> ***Note new street address***
> >> 110 McAllister Way
> >> Santa Cruz, CA 95060
> >> Phone: (831)-420-3666
> >> Fax: (831) 420-3980
> >> e-mail: Roy.Mendelssohn using noaa.gov www: http://www.pfeg.noaa.gov/
> >> "Old age and treachery will overcome youth and skill."
> >> "From those who have been given much, much will be expected"
> >> "the arc of the moral universe is long, but it bends toward justice" -MLK Jr.
> >
>
> **********************
> "The contents of this message do not reflect any position of the U.S. Government or NOAA."
> **********************
> Roy Mendelssohn
> Supervisory Operations Research Analyst
> NOAA/NMFS
> Environmental Research Division
> Southwest Fisheries Science Center
> ***Note new street address***
> 110 McAllister Way
> Santa Cruz, CA 95060
> Phone: (831)-420-3666
> Fax: (831) 420-3980
> e-mail: Roy.Mendelssohn using noaa.gov www: http://www.pfeg.noaa.gov/
>
> "Old age and treachery will overcome youth and skill."
> "From those who have been given much, much will be expected"
> "the arc of the moral universe is long, but it bends toward justice" -MLK Jr.
>
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



More information about the R-package-devel mailing list