[R-pkg-devel] Needing rgeos from sf

Duncan Murdoch murdoch@dunc@n @end|ng |rom gm@||@com
Thu Jul 25 21:56:27 CEST 2019


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.
>



More information about the R-package-devel mailing list