【发布时间】:2021-06-23 14:20:31
【问题描述】:
我想知道是否可以使用 dbplot 包进行绘图并应用 facet_grid 或 facet_wrap,我不确定该包是否支持,或者我做错了什么,这是我的主要想法:
library(odbc)
library(tidyverse)
library(dbplyr)
library(dbplot)
library(DBI)
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") +
theme_minimal()
我最后的错误是:
错误:至少一层必须包含所有刻面变量:gear。
情节缺少齿轮第 1 层缺少齿轮
非常感谢您的帮助!
【问题讨论】: