I am new in shiny, and maybe it can be easy but I could not make it, so I want to select column name firstly and in second box, it show unique values for selected column, and when choosing any values data table and plot appearing, plot will based on filtered part, thats why it is not hard but my main difficulties to extract interactive filter for data and and in default version, it should be whole data. I share what I have dont it is not working and not correct (this code is without data, I can not share data), I corrected some codes, now I can filter according to one value, but I want to see whole data in default version.
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
pickerInput("eda_col", "Select variable",
choices = c("col 1", "col 2", "col 3", "col 4"), selected = character(0)),
uiOutput("varselect"),
# selectInput("xSelector", label = "Select x axis", choices = xAxischoices),
# selectInput("ySelector", label = "Select the y axis", choices = yAxischoices),
# selectInput("cyLSelector", label = "Select a cylinder", choices = cylinderChoices),
actionButton("RefreshPlot", label = "Refresh")
),
mainPanel(
dataTableOutput("datatable1")
)
)
)
server <- function(input, output) {
output$varselect <- renderUI({
vars <- d[[as.name(input$eda_col)]]
checkboxGroupInput("level_choice", "Select factors to include", unique(vars))
})
# vars_r <- reactive({
# input$vars
# })
#
#
# res_mod <- callModule(
# module = selectizeGroupServer,
# id = "my-filters",
# data = d,
# vars = vars_r
# )
#
# output$table <- DT::renderDataTable({
# req(res_mod())
# res_mod()
# })
filteredData <- reactive({
filteredData <- d %>% filter((!! rlang:: sym(input$eda_col)) == input$level_choice)
return(filteredData)
})
output$datatable1 <- renderDataTable({
datatable(filteredData())
})
}
shinyApp(ui, server)