I'm using devtools::check() for a package I'm developing. I keep getting an error that the example for a function failed because it couldn't find a function. The function definition is on the line below the example line in the ROxygen comments:
#' Show Sorenson Impact Theme Colors
#' @description Shows the Sorenson Impact theme colors for reference.
#' @importFrom magrittr "%>%"
#' @return A plot of SI colors
#' @examples
#' SI_colorplot()
SI_colorplot <- function() {
data.frame("color" = names(unlist(SI_design)),
"code" = unlist(SI_design), stringsAsFactors = F) %>%
ggplot2::ggplot() +
ggplot2::geom_rect(ggplot2::aes(fill = I(code)), xmin = 0, xmax = 1, ymin = 0, ymax = 1) +
ggplot2::facet_wrap(~color)
}
SI_design is package data and exists in R/sysdata.rda. But I"ve also tried definiting it in the function, and still get the same error. The function itself works fine.
Just for reference:
SI_design <- list(pacific = "#1D4F53", atlantic = "#18303C", carbon = "#6d6f71", granite = "#bcbdbf", silver = "#e6e7e7", arctic = "#107D7F")
I realize this isn't reprex, but I'm not sure how to do that with a package given all the components. Is there anything glaring that I've done wrong, or any more info on this error?
E checking examples
Running examples in ‘sorensonimpact-Ex.R’ failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: SI_colorplot
> ### Title: Show Sorenson Impact Theme Colors
> ### Aliases: SI_colorplot
>
─ > ### ** Examples
>
> SI_colorplot()
Error in SI_colorplot() : could not find function "SI_colorplot"
Execution halted
See
‘/private/var/folders/5_/l71sk6kn29z17n011g8kld5m0000gp/T/RtmpwIY1JD/filec424773fb1b9/sorensonimpact.Rcheck/00check.log’
for details.