Skip to contents

Writes the count file and a parameter file into dir, runs the TreeScan binary, and reads the results. The data time range and temporal windows are set from the end_date and study_days stored in counts.

Usage

ts_run(
  counts,
  tree,
  dir = tempfile("treescanr_"),
  prm = ts_prm_template(),
  not_evaluated = NULL,
  processes = 2L,
  binary = ts_binary()
)

Arguments

counts

Output of ts_counts().

tree

Path to the TreeScan tree file (long format, e.g. Tree_File_2027.csv).

dir

Output directory. Defaults to a temporary directory; for routine use pass a persistent location such as file.path(tools::R_user_dir("treescanr", "data"), Sys.Date(), "lag1").

prm

A ts_prm object used as template (see ts_prm_template()).

not_evaluated

Optional path to a file of nodes not to evaluate (e.g. Do_not_evaluate_nodes.csv).

processes

Number of parallel processes used by TreeScan.

binary

Path to the TreeScan binary (see ts_binary()).

Value

A ts_result object (see ts_results()).

Examples

if (FALSE) { # \dontrun{
dir <- tools::R_user_dir("treescanr", "data")
res <- read.csv("visits.csv") |>
  ts_visits() |>
  ts_counts(end_date = Sys.Date() - 1, tree_wide = "Tree_File_2026_wide_format.txt") |>
  ts_run(tree = "Tree_File_2027.csv", dir = file.path(dir, Sys.Date(), "lag1"))
res
} # }