Skip to contents

[Experimental]

An S3 structure representing the selection of all possible choices in a filter_spec, select_spec or choices_selected object.

Usage

all_choices()

Value

all_choices object.

Examples

# Both structures are semantically identical
filter_spec(
  vars = c("selected_variable"),
  choices = c("value1", "value2"),
  selected = c("value1", "value2")
)
#> filter_spec with delayed data:
#> $ vars_choices
#> [1] "selected_variable"
#> $ vars_selected
#> [1] "selected_variable"
#> $ vars_label
#> NULL
#> $ vars_fixed
#> [1] TRUE
#> $ vars_multiple
#> [1] TRUE
#> $ choices
#> [1] "value1" "value2"
#> $ selected
#> [1] "value1" "value2"
#> $ label
#> [1] "Filter by"
#> $ multiple
#> [1] TRUE
#> $ fixed
#> [1] FALSE
#> $ sep
#> [1] " - "
#> $ drop_keys
#> [1] FALSE
#> $ dataname
#> NULL
#> $ initialized
#> [1] FALSE

filter_spec(
  vars = c("selected_variable"),
  choices = c("value1", "value2"),
  selected = all_choices()
)
#> filter_spec with delayed data:
#> $ vars_choices
#> [1] "selected_variable"
#> $ vars_selected
#> [1] "selected_variable"
#> $ vars_label
#> NULL
#> $ vars_fixed
#> [1] TRUE
#> $ vars_multiple
#> [1] TRUE
#> $ choices
#> [1] "value1" "value2"
#> $ selected
#> [1] "value1" "value2"
#> $ label
#> [1] "Filter by"
#> $ multiple
#> [1] TRUE
#> $ fixed
#> [1] FALSE
#> $ sep
#> [1] " - "
#> $ drop_keys
#> [1] FALSE
#> $ dataname
#> NULL
#> $ initialized
#> [1] FALSE

choices_selected(choices = letters, selected = letters)
#> $choices
#>  [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s"
#> [20] "t" "u" "v" "w" "x" "y" "z"
#> 
#> $selected
#>  [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s"
#> [20] "t" "u" "v" "w" "x" "y" "z"
#> 
#> $fixed
#> [1] FALSE
#> 
#> attr(,"class")
#> [1] "choices_selected"
choices_selected(choices = letters, selected = all_choices())
#> $choices
#>  [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s"
#> [20] "t" "u" "v" "w" "x" "y" "z"
#> 
#> $selected
#>  [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s"
#> [20] "t" "u" "v" "w" "x" "y" "z"
#> 
#> $fixed
#> [1] FALSE
#> 
#> attr(,"class")
#> [1] "choices_selected"