R6 class to handle MetaRVM configuration data with validation and methods. This class encapsulates all configuration parameters needed for MetaRVM simulations, providing methods for parameter access, validation, and introspection.
Details
The MetaRVMConfig class stores parsed configuration data from YAML files and provides structured access to simulation parameters. It automatically validates configuration completeness and provides convenient methods for accessing demographic categories, initialization-derived population metadata, and other simulation settings.
Public fields
config_filePath to the original YAML config file (if applicable)
config_dataList containing all parsed configuration parameters
Methods
Method get()
Get a configuration parameter
Method get_category_names()
Get names of all category columns
Method get_all_categories()
Get all categories as a named list
Examples
# Initialize from YAML file
example_config <- system.file("extdata", "example_config.yaml", package = "MetaRVM")
config <- MetaRVMConfig$new(example_config)
# Access parameters
config$get("N_pop")
#> [1] 24
config$get("start_date")
#> [1] "2023-09-30"
# Get demographic category names (user-defined)
category_names <- config$get_category_names() # e.g., c("age", "zone", "risk_group")
# Get values for specific categories
ages <- config$get_category_values("age")
# Get all categories as a named list
all_categories <- config$get_all_categories()
## ------------------------------------------------
## Method `MetaRVMConfig$get_category_names`
## ------------------------------------------------
if (FALSE) { # \dontrun{
config <- MetaRVMConfig$new("config.yaml")
category_names <- config$get_category_names() # e.g., c("age", "zone", "risk_group")
} # }
## ------------------------------------------------
## Method `MetaRVMConfig$get_category_values`
## ------------------------------------------------
if (FALSE) { # \dontrun{
config <- MetaRVMConfig$new("config.yaml")
ages <- config$get_category_values("age") # if age is defined
income_levels <- config$get_category_values("income_level") # if defined
} # }
## ------------------------------------------------
## Method `MetaRVMConfig$get_all_categories`
## ------------------------------------------------
if (FALSE) { # \dontrun{
config <- MetaRVMConfig$new("config.yaml")
all_cats <- config$get_all_categories()
# Returns: list(age = c("0-17", "18-64", "65+"), risk_group = c("low", "high"), ...)
} # }
