使用串扰和filter_select选择嵌套数据

时间:2019-03-22 18:11:33

标签: r ggplot2 tidyverse

我有一个嵌套的data.frame,看起来与此示例类似。我想使用crosstalk filter_select从“选定”物种中返回嵌套图。如何在串扰中访问“选定的”共享数据?

    library(tidyverse)
    library(crosstalk)

    irisplot= iris %>% 
      group_by(Species) %>% 
      nest %>% 
      mutate(plot = map2(Species, data,  function (.x,.y){
      ggplot(data = .y, aes(x =  Sepal.Length, y = Sepal.Width)) +
      geom_smooth() +
      ggtitle(label = .x) }))

    shared_df1 <- SharedData$new(irisplot, ~Species, group = "Choose")

    bscols( 
    filter_select("species", 
    "Species:",shared_df1,~Species,multiple=FALSE),

    shared_df1$data$plot ## does not work. What should this be?

    )

0 个答案:

没有答案