Yes, using a package DT
to capture selected rows and a subset of the core set. Here is an example using a set iris
:
library("dplyr")
library("shiny")
library("DT")
summary_iris <- group_by(iris, Species) %>%
summarise(Count = n())
ui <- fluidPage(
dataTableOutput("summary")
, dataTableOutput("drilldown")
)
server <- function(input, output){
output$summary <- DT::renderDataTable(summary_iris)
drilldata <- reactive({
shiny::validate(
need(length(input$summary_rows_selected) > 0, "Select rows to drill down!")
)
selected_species <- summary_iris[as.integer(input$summary_rows_selected), ]$Species
iris[iris$Species %in% selected_species, ]
})
output$drilldown <- DT::renderDataTable(drilldata())
}
shinyApp(ui, server)
source
share