我可以使用以下命令从ggplot2通过管道进行绘图:
library(tidyverse)
library(plotly)
diamonds %>%
{ggplot(.,aes(carat, price)) +
geom_point()} |>
ggplotly()
虽然我在一条链上使用了磁铁管子和底座R管子.
用基本R管替换Magrittr管可实现:
Error: function '{' not supported in RHS call of a pipe
有没有办法只用底座R管?
I found R >4.1 syntax: Error: function 'function' not supported in RHS call of a pipe and https://github.com/plotly/plotly.R/issues/1229
断开链可以避免管道问题:
p <- diamonds |>
ggplot(aes(carat, price)) +
geom_point()
ggplotly(p)