Reputation: 181
I'm trying to build a page using R Shiny that has:
A File Widget for uploading CSV files
A Checkbox Group component
I'd like to use these as follows:
I've tried various forms of observe() and observeEvent() so far, but have had no success in getting this even close. Any suggestions you may have would be great.
Upvotes: 0
Views: 338
Reputation: 388982
You may try checkboxGroupInput
.
library(shiny)
ui <- fluidPage(
fileInput('file', 'Upload csv file'),
uiOutput('dropdown')
)
server <- function(input, output) {
data <- reactive({
req(input$file)
read.csv(input$file$datapath)
})
output$dropdown <- renderUI({
req(data())
checkboxGroupInput('cols', 'Select Column', names(data()),
names(data()), inline = TRUE)
})
}
shinyApp(ui, server)
You can set inline = FALSE
if you want to arrange them vertically.
Upvotes: 1