我希望能够为我的
什么问题?
响应变量
创建ggplots
,与我的数字列
相关。以下是可重现的代码:test = mpg %>% select_if(is.numeric) %>%
dplyr::select(-year) %>% nest(-cyl) %>%
mutate(ggplots = map(data,~ggplot(data = .x) + geom_point(aes(x = cyl, y = .x))))
test
# A tibble: 4 x 3
cyl data ggplots
<int> <list<df[,3]>> <list>
1 4 [81 x 3] <gg>
2 6 [79 x 3] <gg>
3 8 [70 x 3] <gg>
4 5 [4 x 3] <gg>
Warning message:
All elements of `...` must be named.
Did you want `data = c(displ, cty, hwy)`?
错误信息:
test$ggplots[[1]]
Don't know how to automatically pick scale for object of type tbl_df/tbl/data.frame. Defaulting to continuous.
Error: Aesthetics must be either length 1 or the same as the data (81): x, y
什么问题?
data=.x
和aes(y=.x)
。其中一个.x
需要是 data.frame/tibble,另一个需要是列名。你想要绘制什么? - MrFlickcyl
与所有其他numeric cols
绘制在一起。 - Shery