R:在包中调用导入的函数时出错

时间:2019-03-18 20:03:21

标签: r ggplot2 r-package tidyquant

我正在编写一个使用ggplot2和tidyquant的程序包,它们是完全导入的:

#' @import ggplot2
#' @import tidyquant

稍后在我的plot.object()函数中的某处,我绘制了条形图,

x %>%
    ggplot() +
        geom_barchart(
            aes(
                x = date,
                open = open,
                high = high,
                low = low,
                close = close
            )
        )

安装,加载并附加了软件包后,我致电plot.object(),这将导致以下错误:

Error in eval(`_inherit`, env, NULL) : object 'GeomLinerange' not found

和回溯:

12. eval(`_inherit`, env, NULL) 
11. eval(`_inherit`, env, NULL) 
10. super() 
9.  fetch_ggproto(super(), name) 
8.  fetch_ggproto(x, name) 
7.  `$.ggproto`(geom, "aesthetics") 
6.  geom$aesthetics 
5.  as.vector(y) 
4.  intersect(names(params), geom$aesthetics()) 
3.  ggplot2::layer(stat = StatLinerangeBC, geom = GeomLinerangeBC, 
    data = data, mapping = mapping, position = position, show.legend = show.legend, 
    inherit.aes = inherit.aes, params = list(na.rm = na.rm, fill_up = fill_up, 
        fill_down = fill_down, color_up = color_up, color_down = color_down,  ... 
2.  geom_barchart(aes(x = date, open = open, high = high, low = low, 
    close = close)) at moex_candles-plot.R#61
1.  plot.object()

但是,如果在调用plot.object之前附加了ggplo2,则没有错误。

我怀疑这可能是一个tidyquant的错误,因为所有ggplot2函数均按预期工作,并且仅在调用tidyquant::geom_barchart()时才会发生错误。

或者导入魔术师中有我想念的东西吗?

0 个答案:

没有答案