rmaia / pavo

tools for the analysis of color data in R
http://pavo.colrverse.com
GNU General Public License v2.0
69 stars 17 forks source link

R CMD check --as-cran error on example("img_conversion") #197

Closed HenrikBengtsson closed 4 years ago

HenrikBengtsson commented 4 years ago

Hi. I'm running revdepcheck:s on {progressr} and spotted a potential issue with your package where I get check errors on `example("img_conversion"):

> cleanEx()
> nameEx("img_conversion")
> ### * img_conversion
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: img_conversion
> ### Title: Convert images between class rimg and cimg or magick-image
> ### Aliases: img_conversion rimg2cimg rimg2magick
> 
> ### ** Examples
> 
> papilio <- getimg(system.file("testdata/images/papilio.png", package = "pavo"))
> 
> # From class rimg to cimg
> papilio_cimg <- rimg2cimg(papilio)
Error: Package "imager" needed for conversion to cimg. Please install it.
Execution halted

Despite \donttest{}, I think this example needs to run conditionally on:

if requireNamespace("imager", quiety=TRUE) {
   ...
}

You could hide that pre- and post- statement in a \dontshow{}

If {imager} would disappear from CRAN, then I think your package might fail the same way on CRAN too.

HenrikBengtsson commented 4 years ago

Forgot to say, this only happens when you check without {imager} installed.

Bisaloo commented 4 years ago

Thank you!

Note for future reference: it might be cleaner to use conditional examples when roxygen2 supports it (https://github.com/gaborcsardi/roxygenlabs#conditional-examples)