I have a checkbox and a table in my code. What I want is when user check certain box, new column with corresponding name with be generated.
Ideal Case Example:
However, this is what I have with my code:
Here is my code:
lineGraphUI <- function(id) {
ns <- NS(id)
tags$div(
checkboxGroupInput(ns("variable"), "Variables to show:",
c("black" = "black",
"white" = "white",
"asian" = "asian")),
tableOutput(ns("datatbr"))
)
}
lineGraph <- function(input, output, session) {
da <- read.csv(file = "RaceByYearTemplet.csv", header = TRUE)
output$datatbr <- renderTable({
da[c("year",input$variable), drop = FALSE]
}, rownames = TRUE)
}
navBlockUI <- function(id) {
ns <- NS(id)
tags$div(
tags$div(class = "tabPanel-plotBlock",
tabsetPanel(type = "tabs",
tabPanel("Graph", lineGraphUI(ns("line"))),
tabPanel("Line", tablePlotUI(ns("table")))
)
)
)
}
navBlock <- function(input, output, session) {
callModule(lineGraph, "line")
callModule(tablePlot, "table")
}
I think the problem might shiny module can not be update when the checkbox is checked? Because I have tried to put the same code directly in app.R and it works just fine(as it shows in the 'ideal case example' image above).