child: Make child nm object from parent

View source: R/nm_object.R

childR Documentation

Make child nm object from parent

Description

[Stable]

Child objects inherit attributes of parent but with a new run_id. The control file will be inherited too with $TABLEs updated.

Usage

child(m, run_id = NA_character_, type = "execute", parent = m, silent = FALSE)

Arguments

m

Parent nm object.

run_id

Character. New run_id to assign to child object.

type

Character (default = "execute"). Type of child object.

parent

Optional nm object (default = m) . Parent object will by default be m, but this argument will force parent to be a different object.

silent

Logical (default = FALSE). Should warn if conflicts detected.

Details

Specifying parent will force parent to be different from m. This is useful in piping when a parent object is modified prior to being used in the child object.

Value

An new nm object with modified parent_* fields updated to be the * fields of the parent object, m.

Examples


exdir <- system.file("extdata", "examples", "theopp", package = "NMproject")
m1 <- new_nm(run_id = "m1", 
             based_on = file.path(exdir, "Models", "ADVAN2.mod"),
             data_path = file.path(exdir, "SourceData", "THEOPP.csv"))

m2 <- m1 %>% child("m2")

nm_diff(m2, m1)


tsahota/NMproject documentation built on Oct. 1, 2022, 11:51 a.m.