select_spec | R Documentation |
select_spec
is used inside teal
to create a shiny::selectInput()
that will select columns from a dataset.
select_spec(
choices,
selected = if (inherits(choices, "delayed_data")) NULL else choices[1],
multiple = length(selected) > 1 || inherits(selected, "all_choices"),
fixed = FALSE,
always_selected = NULL,
ordered = FALSE,
label = "Select"
)
select_spec.delayed_data(
choices,
selected = NULL,
multiple = length(selected) > 1,
fixed = FALSE,
always_selected = NULL,
ordered = FALSE,
label = NULL
)
select_spec.default(
choices,
selected = choices[1],
multiple = length(selected) > 1,
fixed = FALSE,
always_selected = NULL,
ordered = FALSE,
label = NULL
)
choices |
( |
selected |
(optional |
multiple |
( |
fixed |
(optional |
always_selected |
( |
ordered |
( |
label |
(optional |
A select_spec
-S3 class object or delayed_select_spec
-S3-class object.
It contains all input values.
If select_spec
, then the function double checks the choices
and selected
inputs.
# Selection with just one column allowed
select_spec(
choices = c("AVAL", "BMRKR1", "AGE"),
selected = c("AVAL"),
multiple = FALSE,
fixed = FALSE,
label = "Column"
)
# Selection with just multiple columns allowed
select_spec(
choices = c("AVAL", "BMRKR1", "AGE"),
selected = c("AVAL", "BMRKR1"),
multiple = TRUE,
fixed = FALSE,
label = "Columns"
)
# Selection without user access
select_spec(
choices = c("AVAL", "BMRKR1"),
selected = c("AVAL", "BMRKR1"),
multiple = TRUE,
fixed = TRUE,
label = "Columns"
)
# Delayed version
select_spec(
label = "Select variable:",
choices = variable_choices("ADSL", c("BMRKR1", "BMRKR2")),
selected = "BMRKR1",
multiple = FALSE,
fixed = FALSE
)
# all_choices passed to selected
select_spec(
label = "Select variable:",
choices = variable_choices("ADSL", c("BMRKR1", "BMRKR2")),
selected = all_choices()
)
# Both below objects are semantically the same
select_spec(choices = variable_choices("ADSL"), selected = variable_choices("ADSL"))
select_spec(choices = variable_choices("ADSL"), selected = all_choices())
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.