LegacyRunWebVersion: LegacyRunWebVersion method

LegacyRunWebVersionR Documentation

LegacyRunWebVersion method

Description

This method offers a way to configure and run a simulation from an input configuration file. Rather than return a R DataFrame, it produces results in an output file. It works in the same as calling the CLI version of the Smoking History Generator with a single input file parameter.

Arguments

input_file_name

Path to a Legacy web-style configuration file. Paths inside the file are resolved relative to the R process working directory (the input_data_folder property is ignored). Sample text configs live under tests/testdata/legacy-web-examples/ in the package source; for installed use, build a config with absolute paths from system.file("extdata", "2018", package = "SmokingHistoryGenerator").

Value

No return value. Called for side effects: runs the CLI-style engine and writes semicolon-separated results to OUTPUTFILE and diagnostics to ERRORFILE as specified in the configuration file (properties on the R object are ignored).

Examples

shg <- new(SHGInterface)
d <- system.file("extdata", "2018", package = "SmokingHistoryGenerator")
tf <- tempfile(fileext = ".txt")
writeLines(c(
  "RNGSTRATEGY=RngStream",
  "RNGSTREAM_SEED=12345,12345,12345,12345,12345,12345",
  "RACE=0", "SEX=0", "YOB=1950", "CESSATION_YR=0", "REPEAT=100",
  paste0("INIT_PROB=", file.path(d, "smoking", "initiation.csv")),
  paste0("CESS_PROB=", file.path(d, "smoking", "cessation.csv")),
  paste0("MORTALITY_PROB=", file.path(d, "mortality", "acm.csv")),
  paste0("CPD_DATA=", file.path(d, "smoking", "cpd.csv")),
  paste0("OUTPUTFILE=", tempfile("out_", fileext = ".txt")),
  paste0("ERRORFILE=", tempfile("err_", fileext = ".txt"))
), tf)
shg$LegacyRunWebVersion(tf)

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