R Language Shiny Checkbox Group

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

Create a group of checkboxes that can be used to toggle multiple choices independently. The server will receive the input as a character vector of the selected values.

library(shiny)

ui <- fluidPage(    
  checkboxGroupInput("checkGroup1", label = h3("This is a Checkbox group"), 
                 choices = list("1" = 1, "2" = 2, "3" = 3),
                 selected = 1),
  fluidRow(column(3, verbatimTextOutput("text_choice")))
  ) 


server <- function(input, output){
  output$text_choice <- renderPrint({
    return(paste0("You have chosen the choice ",input$checkGroup1))})
} 

shinyApp(ui = ui, server = server)

enter image description here

It's possible to change the settings :

  • label : title
  • choices : selected values
  • selected : The initially selected value (NULL for no selection)
  • inline : horizontal or vertical
  • width

It is also possible to add HTML.



Got any R Language Question?