Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

filter_select

Categorical filter controls


Description

Creates a select box or list of checkboxes, for filtering a SharedData object based on categorical data.

Usage

filter_select(id, label, sharedData, group, allLevels = FALSE, multiple = TRUE)

filter_checkbox(
  id,
  label,
  sharedData,
  group,
  allLevels = FALSE,
  inline = FALSE,
  columns = 1
)

Arguments

id

An HTML element ID; must be unique within the web page

label

A human-readable label

sharedData

SharedData object with the data to filter

group

A one-sided formula whose values will populate this select box. Generally this should be a character or factor column; if not, it will be coerced to character.

allLevels

If the vector described by group is factor-based, should all the levels be displayed as options, or only ones that are present in the data?

multiple

Can multiple values be selected?

inline

If TRUE, render checkbox options horizontally instead of vertically.

columns

Number of columns the options should be arranged into.

Examples

## Only run examples in interactive R sessions
if (interactive()) {

sd <- SharedData$new(chickwts)
filter_select("feedtype", "Feed type", sd, "feed")

}

crosstalk

Inter-Widget Interactivity for HTML Widgets

v1.1.1
MIT + file LICENSE
Authors
Joe Cheng [aut], Carson Sievert [aut, cre] (<https://orcid.org/0000-0002-4958-2844>), RStudio [cph], jQuery Foundation [cph] (jQuery library and jQuery UI library), jQuery contributors [ctb, cph] (jQuery library; authors listed in inst/www/shared/jquery-AUTHORS.txt), Mark Otto [ctb] (Bootstrap library), Jacob Thornton [ctb] (Bootstrap library), Bootstrap contributors [ctb] (Bootstrap library), Twitter, Inc [cph] (Bootstrap library), Brian Reavis [ctb, cph] (selectize.js library), Kristopher Michael Kowal [ctb, cph] (es5-shim library), es5-shim contributors [ctb, cph] (es5-shim library), Denis Ineshin [ctb, cph] (ion.rangeSlider library), Sami Samhuri [ctb, cph] (Javascript strftime library)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.