keep_na_input {shinyCohortBuilder}R Documentation

Generate NA's filter selection GUI input

Description

When used within filter's GUI input method, the component is responsible for updating 'keep_na' filter parameter.

Use ‘.update_keep_na_input' inside filter’s GUI update method to update the output based on the filter state.

Usage

.keep_na_input(
  input_id,
  filter,
  cohort,
  msg_fun = function(x) glue::glue("Keep missing values ({x})")
)

.update_keep_na_input(
  session,
  input_id,
  filter,
  cohort,
  msg_fun = function(x) glue::glue("Keep missing values ({x})")
)

Arguments

input_id

Id of the keep na input.

filter

Filter object.

cohort

Cohort object.

msg_fun

Function taking number of missing values as an argument and returning missing values label.

session

Shiny session object.

Value

Nested list of 'shiny.tag' objects storing html structure of the input, or no value in case of usage 'update' method.

Examples

library(magrittr)
library(cohortBuilder)

librarian_source <- set_source(as.tblist(librarian))
coh <- cohort(
  librarian_source,
  filter(
    "range", id = "copies", name = "Copies", dataset = "books",
    variable = "copies", range = c(5, 12)
  )
) %>% run()
.keep_na_input("keep_na", coh$get_filter("1", "copies"), coh)


[Package shinyCohortBuilder version 0.2.1 Index]