[R-pkg-devel] Function editGrob not found unless grid is in Depends

Ayala Hernandez, Rafael r@@y@|@14 @end|ng |rom |mper|@|@@c@uk
Wed Nov 11 17:05:46 CET 2020


Dear all,

I have recently been trying to write a plotting function where a external PNG file is drawn onto a ggmap object.

I managed to achieve this by using ggmap::inset , inputting as a grob the result of applying grid::rasterGrob to the image rotated with magick::image_rotate .

I therefore added ggmap, ggplot2, grid and magick to Imports in DESCRIPTION, and added the corresponding imports in NAMESPACE

However, when running R CMD check, I got an error saying 'could not find function editGrob', when running the example code for the mentioned plotting function.
I confirmed the error also happens if I install and load the package in a fresh R session.

If I then load explicitly grid through library(grid), the error disappears.

I tried to add explicitly importFrom("grid", editGrob) to NAMESPACE, but that made no difference.

I have only been able to solve the problem by adding "grid" to Depends in DESCRIPTION instead of Imports.

The code for the problematic plotting function can be found at https://github.com/Rafael-Ayala/openSkies/blob/main/R/openSkies_plottingFunctions.R (lines 61 to 91)

I would greatly appreciate if anybody could clarify why "grid" needs to be added to Depends in this case, and why not even adding NAMESPACE importFrom("grid", editGrob) fixes the problem if "grid" is left in Imports!

Thanks a lot in advance

Best wishes,

Rafa



	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list