我正在尝试这个非常简单的代码:
mtcars %>%
mutate(Bla = cyl+mpg) %>%
ggplot(. %>%
filter(am == 1), aes(x = mpg, y = cyl)) +
geom_point()
它不起作用并给出错误
You've supplied a <fseq> object
。但是,以下工作有效:
ggplot(mtcars %>%
mutate(Bla = cyl+mpg) %>%
filter(am == 1), aes(x = mpg, y = cyl)) +
geom_point()
因此,似乎不可能将点
.
参数传递给ggplot,然后沿着管道跟随它。
我发誓我曾经能够做到这一点,因此我的问题是:
您需要添加 , 映射 = 才能使其工作
mtcars %>%
mutate(Bla = cyl+mpg) %>%
ggplot(. %>% filter(am == 1), mapping = aes(x = mpg, y = cyl)) +
geom_point()