1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/inputs.R
\name{input_checkbox}
\alias{input_checkbox}
\title{Create an interactive checkbox.}
\usage{
input_checkbox(
value = FALSE,
label = "",
id = rand_id("checkbox_"),
map = identity
)
}
\arguments{
\item{value}{Initial value (\code{TRUE} or \code{FALSE}).}
\item{label}{Display label for the control, or \code{NULL} for no label.}
\item{id}{A unique identifier for this input. Usually generated
automatically.}
\item{map}{A function with single argument \code{x}, the value of the
control on the client. Returns a modified value.}
}
\description{
Create an interactive checkbox.
}
\examples{
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)
}
\seealso{
Other interactive input:
\code{\link{input_select}()},
\code{\link{input_slider}()},
\code{\link{input_text}()}
}
\concept{interactive input}
|