Learn R Programming

EpiNow2 (version 1.3.2)

filter_opts: Filter Options for a Target Region

Description

A helper function that allows the selection of region specific settings if present and otherwise applies the overarching settings

Usage

filter_opts(opts, region)

Arguments

opts

Either a list of calls to an _opts function or a single call to an _opts function.

region

A character string indicating a region of interest.

Value

A list of options

Examples

Run this code
# NOT RUN {
# uses example case vector
cases <- example_confirmed[1:40]
cases <- data.table::rbindlist(list(
  data.table::copy(cases)[, region := "testland"],
  cases[, region := "realland"]))
  
# regional options
regional_opts <- opts_list(rt_opts(), cases)
EpiNow2:::filter_opts(regional_opts, "realland")
# default only
EpiNow2:::filter_opts(rt_opts(), "realland")
#settings are NULL in one regions
regional_opts <- update_list(regional_opts, list(realland = NULL))
EpiNow2:::filter_opts(regional_opts, "realland")
# }

Run the code above in your browser using DataLab