Skip to contents

A parameter file (.prm) is stored as its raw lines (comments included) with class ts_prm. Values are set by key name, without needing to know the [Section] they belong to.

Usage

ts_prm_read(path)

ts_prm_template()

ts_prm_set(prm, ...)

ts_prm_get(prm, key)

ts_prm_write(prm, path)

Arguments

path

Path to a .prm file.

prm

A ts_prm object.

...

Named values to set, e.g. "monte-carlo-replications" = 999. Dates are formatted as yyyy/mm/dd, logicals as y/n.

key

Parameter name.

Value

ts_prm_read(), ts_prm_template(), and ts_prm_set() return a ts_prm object. ts_prm_get() returns a character value. ts_prm_write() returns path invisibly.

Details

ts_prm_template() returns the template bundled with the package (TreeScan v2.4.1, tree-temporal Poisson scan, 9,999 replications).

Examples

prm <- ts_prm_template() |>
  ts_prm_set("monte-carlo-replications" = 999)
ts_prm_get(prm, "monte-carlo-replications")
#> [1] "999"
ts_prm_write(prm, tempfile(fileext = ".prm"))