checkboxGroupInput: Checkbox Group Input Control

Description Usage Arguments Value See Also Examples

View source: R/input-checkboxgroup.R

Description

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.

Usage

1
2
checkboxGroupInput(inputId, label, choices, selected = NULL, inline = FALSE,
  width = NULL)

Arguments

inputId

The input slot that will be used to access the value.

label

Display label for the control, or NULL for no label.

choices

List of values to show checkboxes for. If elements of the list are named then that name rather than the value is displayed to the user.

selected

The values that should be initially selected, if any.

inline

If TRUE, render the choices inline (i.e. horizontally)

width

The width of the input, e.g. '400px', or '100%'; see validateCssUnit.

Value

A list of HTML elements that can be added to a UI definition.

See Also

checkboxInput, updateCheckboxGroupInput

Other input.elements: actionButton, checkboxInput, dateInput, dateRangeInput, fileInput, numericInput, passwordInput, radioButtons, selectInput, sliderInput, submitButton, textInput

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Only run examples in interactive R sessions
if (interactive()) {

ui <- fluidPage(
  checkboxGroupInput("variable", "Variables to show:",
                     c("Cylinders" = "cyl",
                       "Transmission" = "am",
                       "Gears" = "gear")),
  tableOutput("data")
)

server <- function(input, output) {
  output$data <- renderTable({
    mtcars[, c("mpg", input$variable), drop = FALSE]
  }, rownames = TRUE)
}

shinyApp(ui, server)
}

ymd526442121/Rproject_shiny documentation built on May 4, 2019, 5:31 p.m.