Here's a minimal reprex of a simple data table in my Shiny app:
library(shiny)
library(DT)
shinyApp(
ui <- fluidPage(
DT::dataTableOutput("data")
),
server <- function(input, output) {
df <- reactiveValues(data = data.frame(
Category = c('animal', 'plant', 'plant', 'car', 'car', 'drink', 'food'),
Description = c("dog","rose","lilly","mercedes","honda","cola","burger"),
stringsAsFactors = FALSE
))
output$data <- DT::renderDataTable(
df$data, server = FALSE, escape = FALSE, selection = 'none'
)
})
})
Is there some way I can add a button to show only unique values in the "category" column?
The question of which row to keep does not matter here.
So can I add some button to make the resulting (unique) table with the following 5 variables?
- animal
- plant
- car
- drink
- food
Thanks!