Learn R Programming

shinyCohortBuilder (version 0.4.0)

keep_na_input: 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})") )

Value

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

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.

Examples

Run this code
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)

Run the code above in your browser using DataLab