在mtcars数据集的情况下,如何根据cyl的交互选择来填充点/标记。我的代码不起作用
mtcars%>%ggvis(~mpg,~disp)%>%filter(cyl %in% input_select(c("4","6","8"),selected="4",map=as.numeric))%>%layer_points()
答案 0 :(得分:0)
确保 dplyr 已加载,您当前需要eval
input_select
使用library(ggvis)
library(dplyr)
mtcars %>%
ggvis(~mpg, ~disp) %>%
filter(cyl %in% eval(input_select(c("4", "6", "8"), selected = "4"))) %>%
layer_points()
,如图所示here。
Labels