useConfig: Use SHG Configuration

useConfigR Documentation

Use SHG Configuration

Description

Configures an existing SHG instance from a configuration object (typically obtained from getConfig()).

Arguments

config

A list containing configuration parameters. Must include config_version. All parameters are validated.

Details

Configure SHG instance from config object

This method validates the config_version and all parameters before setting them. Unknown fields are warned about but allowed for future compatibility. Missing optional fields use defaults. Fields are applied in an order suitable for round-trips from getConfig(): number_of_segments and num_threads are set before rng_strategy (so switching to Mersenne Twister does not message when the saved list already has single-threaded settings), then seeds, then paths and other options. If the list has deprecated run_multi_threaded but no num_threads, it is mapped: FALSE -> num_threads = 1, TRUE -> num_threads = -1. If both are present, num_threads wins. If the list updates local input paths (input_data_folder or any per-table filename) but omits smok_params_source, mort_params_source, and mort_params_type, any previously recorded bundle provenance is cleared for the omitted key(s) so metadata cannot refer to an older zip after retargeting inputs.

Value

No return value. Called for side effects: updates fields on the SHGInterface instance to match config (typically from getConfig).

Examples

shg1 <- new(SHGInterface)
shg1$input_data_folder <- system.file("extdata", "2018", package = "SmokingHistoryGenerator")
shg1$rng_strategy <- "RngStream"
shg1$number_of_segments <- 4
config <- shg1$getConfig()
shg2 <- new(SHGInterface)
shg2$useConfig(config)
shg2$rng_strategy

SmokingHistoryGenerator documentation built on June 13, 2026, 1:08 a.m.