交互式过滤和数据可视化

时间:2016-12-22 16:44:08

标签: r ggvis

在mtcars数据集的情况下,如何根据cyl的交互选择来填充点/标记。我的代码不起作用

mtcars%>%ggvis(~mpg,~disp)%>%filter(cyl %in% input_select(c("4","6","8"),selected="4",map=as.numeric))%>%layer_points()

1 个答案:

答案 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