Description Usage Arguments See Also Examples
Create an interactive checkbox.
1 2 | input_checkbox(value = FALSE, label = "", id = rand_id("checkbox_"),
map = identity)
|
value |
Initial value ( |
label |
Display label for the control. |
id |
A unique identifier for this input. Usually generated automatically. |
map |
A function with single argument |
Other interactive input: input_checkboxgroup
,
input_radiobuttons
,
input_select
; input_numeric
,
input_text
; input_slider
1 2 3 4 5 6 7 8 9 10 11 12 | input_checkbox(label = "Confidence interval")
input_checkbox(label = "Confidence interval", value = TRUE)
# Used in layer_smooths
mtcars %>% ggvis(~wt, ~mpg) %>%
layer_smooths(se = input_checkbox(label = "Confidence interval"))
# Used with a map function, to convert the boolean to another type of value
model_type <- input_checkbox(label = "Use flexible curve",
map = function(val) if(val) "loess" else "lm")
mtcars %>% ggvis(~wt, ~mpg) %>%
layer_model_predictions(model = model_type)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.