I'm trying to build a package which contains a number of plotting functions, primarily based on ggplot2, which also uses guide_axis_minor from ggh4x. I import ggplot2 in total, since my code uses many of its functions, and import specifically the guide_axis_minor function from ggh4x, however when I run check() (specifically the part where it tests examples) I get the following error:
Error in get(as.character(FUN), mode = "function", envir = envir) :
object 'guide_axis_minor' of mode 'function' was not found
I built a small test package which reproduces the issue using one function called plot. Here is the code for that function:
#' Plot
#'
#' @param data
#'
#' @return
#' @export
#' @import ggplot2
#' @importFrom ggh4x guide_axis_minor
#'
#' @examples
#' plot(data.frame(x = 1:10, y = 1:10))
plot <- function(data){
ggplot(data, aes(x, y)) +
geom_line() +
scale_y_continuous(guide = 'axis_minor')
}
Here is my DESCRIPTION file:
Package: test
Title: What the Package Does (One Line, Title Case)
Version: 0.0.0.9000
Authors@R:
person("First", "Last", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "YOUR-ORCID-ID"))
Description: What the package does (one paragraph).
License: `use_mit_license()`, `use_gpl3_license()` or friends to pick a
license
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
Imports:
ggh4x,
ggplot2
And here is my NAMESPACE file:
# Generated by roxygen2: do not edit by hand
export(plot)
import(ggplot2)
importFrom(ggh4x,guide_axis_minor)
If more information about the package would help, I'll be happy to provide it. What am I doing wrong?