I've currently got a reactable stored as an object in some code. I'd like to be able to convert said object into a ggplot, but no matter what I do, I get variations of the same error. Using blastula's add_ggplot function, I get:
Error in UseMethod("grid.draw") :
no applicable method for 'grid.draw' applied to an object of class "c('reactable', 'htmlwidget')"
Using ggplotify's as.ggplot function, I get:
Error in UseMethod("as.grob") :
no applicable method for 'as.grob' applied to an object of class "c('reactable', 'htmlwidget')"
Does anyone have advice on how to achieve the desired result?
EDIT: In answer to a question I probably should have answered originally: the reactable is derived from a very run-of-the-mill dataframe.
df <- structure(list(Date = c("2019-02-09", "2019-02-09", "2019-02-09",
"2019-02-09", "2019-02-09", "2019-02-09", "2020-02-09", "2020-02-09",
"2020-02-09", "2020-02-09", "2021-02-09", "2021-02-09", "2021-02-09",
"2021-02-09"), Type = c("HUF", "HAD", "WOK", "STR", "HUF", "HAD",
"WOK", "STR", "HUF", "HAD", "WOK", "STR", "HUF", "HAD"), Value = c(12L,
226394L, 27566L, 217098L, 208463L, 9320L, 156607L, 19790L, 24541L,
1074419L, 17250L, 12249L, 43651L, 45121L)), class = "data.frame", row.names = c(NA,
-14L))
EDIT2: Here is the reactable code, apologies for not including it earlier:
react_df <- reactable(df, highlight = TRUE, compact = TRUE,pagination = FALSE, columns = list(Date = colDef(name = "Last Recorded", align = 'center'), Type = colDef(name = "Category", align = 'center'), Value = colDef(name = "Change(s)", align = 'center', cell = data_bars(df, background = "white", border_width = "2px", bar_height = 3, align_bars = "left", text_position = "outside-end", max_value = 1, number_fmt = scales::percent))))
react_df