Can i perform a facet_wrap or facet_grid with dbplot package?

Hello all,

Im wondering if it´s possible to make a plot with the dbplot package and apply facet_grid or facet_wrap, im not sure if the package supports that or if im doing something wrong, here is the main idea that i have:


con <- dbConnect(RSQLite::SQLite(), ":memory:")

db_cars <- copy_to(con, mtcars, "cars")

db_cars %>% 
  db_compute_bins(mpg) %>% 
  ggplot() +
  geom_col(aes(mpg,count,fill = count)) +
  #Here is were i try to do the facet, i think that maybe it doesent work because i´m not computing 
  #gear, but i have tried to do it separately with a pipe  but still doesent work
  facet_wrap(~gear) +
  labs(title = "Mtcars - mpg distribution") +

The error that i have at the end is:
Error: At least one layer must contain all faceting variables: gear.

  • Plot is missing gear
  • Layer 1 is missing gear

Thanks a lot for your help!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.