update_selected: determine the proper selection

Description Usage Arguments Value Examples

Description

Used for shiny::selectInput to allow you to update its selection when its choices change.

Usage

1
update_selected(value, choices, index = NULL)

Arguments

value

character vector, current value of an input

choices

character vector, new choices for an input

index

integer, if value is not in defualt choices, uses this index of choices.

Value

character vector of proposed selection

Examples

1
2
3
4
  update_selected("a", c("a", "b", "c"))
  update_selected("a", NULL)
  update_selected("d", c("a", "b", "c"))
  update_selected("d", c("a", "b", "c"), index = 1)

ijlyttle/shinypod documentation built on May 18, 2019, 3:41 a.m.