1

I'm writing a package, that uses both ggplot2 and tidyquant, which are fully imported:

#' @import ggplot2
#' @import tidyquant

Later somewhere in my plot.object() function I plot a bar chart with

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

After the package is installed, loaded & attached, I call plot.object(), which results in the following error:

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

and the traceback:

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()

However, if ggplo2 is attached prior to calling plot.object, then there is no error.

I suspect it might be a tidyquant's bug, because all ggplot2 functions work as expected, and the error occurs only if tidyquant::geom_barchart() is called.

Or is there something in the importing magick that I'm missing?

camille
  • 16,432
  • 18
  • 38
  • 60
Dmitry Zotikov
  • 2,133
  • 15
  • 12

0 Answers0