| LegacyRunWebVersion | R Documentation |
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.
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 |
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).
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.