我可以从ggplot2中巧妙地使用:
library(tidyverse)
library(plotly)
diamonds %>%
{ggplot(.,aes(carat, price)) +
geom_point()} |>
ggplotly()虽然我在一条链中使用了magrittr管和基本R管。
将magrittr管替换为基本R管的结果如下:
Error: function '{' not supported in RHS call of a pipe有没有办法只使用R基管?
我找到了R >4.1 syntax: Error: function 'function' not supported in RHS call of a pipe和https://github.com/plotly/plotly.R/issues/1229
断链可避免管道问题:
p <- diamonds |>
ggplot(aes(carat, price)) +
geom_point()
ggplotly(p)发布于 2022-09-17 14:04:27
另一个选择是
library(ggplot2)
library(plotly)
(diamonds |>
ggplot(aes(carat, price)) +
geom_point()) |>
ggplotly()https://stackoverflow.com/questions/73752006
复制相似问题