14  Composing results

14.1 Overview

ems_compose() retrieves and processes results from a solved model run. Results are parsed and filtered according to the which argument. Data validation and consistency checks are performed during the parsing process.

By default, ems_solve() calls ems_compose() automatically, so this function is primarily used when suppress_outputs = TRUE was passed to ems_solve() or solve_in_situ(), or when re-parsing results from a previous run.

14.2 Arguments

Argument Default Description
cmf_path Path to the CMF file generated by ems_deploy()
which "all" "all" returns all model variables and all coefficients (if coefficient output files are present). Any other value is treated as a character vector of variable and/or coefficient names to retrieve — an error is raised for any name not found

14.3 Basic usage

After a standard model run with suppressed outputs:

ems_solve(
  cmf_path = cmf_path,
  matrix_method = "LU",
  solution_method = "Johansen",
  suppress_outputs = TRUE
)

# Parse all results
outputs <- ems_compose(cmf_path = cmf_path)

14.4 Filtering output

Pass a character vector of names to which to retrieve a subset of results. Variables and coefficients can be mixed freely in a single call:

# All model variables and coefficients (default)
all_outputs <- ems_compose(cmf_path = cmf_path)

# Single variable by name
qfd <- ems_compose(cmf_path = cmf_path, which = "qfd")

# Single coefficient by name
SAVE <- ems_compose(cmf_path = cmf_path, which = "SAVE")

# Multiple names — variables and coefficients can be mixed
results <- ems_compose(cmf_path = cmf_path, which = c("qfd", "qfm", "SAVE"))

Note that some coefficient names differ from their associated HAR headers. For example, the coefficient exposed as "VTMFSD" corresponds to the VTWR header. Use the name as it appears in the model file, not the header.

14.5 Return value

ems_compose() returns a tibble with one row per result and four columns:

Column Description
name Variable or coefficient name as it appears in the model file
label Description string from the model file
type "variable" or "coefficient"
dat List-column of data.tables, one per row, containing the result values