R Package Devel Error:运行示例失败,找不到函数

时间:2018-01-04 19:09:23

标签: r r-package

我正在使用devtools :: check()来开发我正在开发的软件包。我一直收到一个错误,即函数的示例因为无法找到函数而失败。函数定义位于ROxygen注释中示例行下方的行上:

#' 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是包数据,存在于R / sysdata.rda中。但我也试过在函数中定义它,但仍然得到同样的错误。函数本身工作正常 仅供参考:

SI_design <- list(pacific = "#1D4F53", atlantic = "#18303C", carbon = "#6d6f71", granite = "#bcbdbf", silver = "#e6e7e7", arctic = "#107D7F")

我意识到这不是代表,但我不知道如何使用包含所有组件的包来做到这一点。有什么明显的错误我做错了,还是有关此错误的更多信息?

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.

0 个答案:

没有答案