R: Picker Group

pickerGroup-module {shinyWidgets} | R Documentation

## Picker Group

### Description

Group of mutually dependent ‘pickerInput' for filtering data.frame’s columns.

### Usage

    pickerGroupUI(id, params, label = NULL, btn_label = "Reset filters",
      options = list())

    pickerGroupServer(input, output, session, data, vars)

### Arguments

`id` | Module's id.
`params` | a named list of parameters passed to each 'pickerInput', you can use : 'inputId' (obligatory, must be variable name), 'label', 'placeholder'.
`label` | character, global label on top of all labels.
`btn_label` | reset button label.
`options` | See `pickerInput` options argument.
`input` | standard `shiny` input.
`output` | standard `shiny` output.
`session` | standard `shiny` session.
`data` | a `data.frame`, or an object coercible to `data.frame`.
`vars` | character, columns to use to create filters, must correspond to variables listed in `params`.

### Value

a `reactive` function containing data filtered.

### Examples

    ## Not run:

    if (interactive()) {

    library(shiny)
    library(shinyWidgets)

    data("mpg", package = "ggplot2")

    ui <- fluidPage(
      fluidRow(
        column(
          width = 10, offset = 1,
          tags$h3("Filter data with picker group"),
          panel(
            pickerGroupUI(
              id = "my-filters",
              params = list(
                manufacturer = list(inputId = "manufacturer", title = "Manufacturer:"),
                model = list(inputId = "model", title = "Model:"),
                trans = list(inputId = "trans", title = "Trans:"),
                class = list(inputId = "class", title = "Class:")
              )
            ), status = "primary"
          ),
          dataTableOutput(outputId = "table")
        )
      )
    )

    server <- function(input, output, session) {
      res_mod <- callModule(
        module = pickerGroupServer,
        id = "my-filters",
        data = mpg,
        vars = c("manufacturer", "model", "trans", "class")
      )
      output$table <- renderDataTable(res_mod())
    }

    shinyApp(ui, server)

    }

    ## End(Not run)

[Package shinyWidgets version 0.4.3 Index]