manipulateWidget (version 0.10.1)

mwSelectize: Add a Select list input to a manipulateWidget gadget

Description

Add a Select list input to a manipulateWidget gadget

Usage

mwSelectize(
  choices = value,
  value = NULL,
  label = NULL,
  ...,
  multiple = FALSE,
  options = NULL,
  .display = TRUE
)

Arguments

choices

Vector or list of choices. If it is named, then the names rather than the values are displayed to the user.

value

Initial value of the input. If not specified, the first choice is used.

label

Display label for the control. If NULL, the name of the corresponding variable is used.

...

Other arguments passed to functionselectInput.

multiple

Is selection of multiple items allowed?

options

A list of options. See the documentation of selectize.js for possible options

.display

expression that evaluates to TRUE or FALSE, indicating when the input control should be shown/hidden.

Value

A function that will generate the input control.

See Also

Other controls: mwCheckboxGroup(), mwCheckbox(), mwDateRange(), mwDate(), mwGroup(), mwNumeric(), mwPassword(), mwRadio(), mwSelect(), mwSharedValue(), mwSlider(), mwText()

Examples

Run this code
# NOT RUN {
if (require(plotly)) {
  mydata <- data.frame(x = 1:100, y = rnorm(100))

  # Select multiple values
  manipulateWidget(
    {
      if (length(species) == 0) mydata <- iris
      else mydata <- iris[iris$Species %in% species,]

      plot_ly(mydata, x = ~Sepal.Length, y = ~Sepal.Width,
              color = ~droplevels(Species), type = "scatter", mode = "markers")
    },
    species = mwSelectize(c("Select one or two species : " = "", levels(iris$Species)),
        multiple = TRUE, options = list(maxItems = 2))
  )
}

# }

Run the code above in your browser using DataLab