Create a new parent nm
object. Normally the first NONMEM object you create
will be using this function. Subsequent objects created with the child()
function will inherit the properties of the parent run.
new_nm(based_on, run_id = NA_character_, data_path, cmd, force = FALSE)
Character. Relative path to an existing control file from
which to base this run. NMproject will not modify or run this control
file. Instead it will create a new control file specified by the
ctl_name
field (see Details below).
Character. Run identifier. This is used to name the run and output files such as $TABLE outputs.
Character. Path to dataset. If this is not specified,
NMproject will try to guess based on the current $DATA components of the
file specified in based_on
. However it is recommended to specify this
explicitly as a relative path.
Optional character. PsN command to use. If unspecified will use
getOption("nm_default_fields")
value of cmd
. Use glue notation for
inheritance. See details.
(Default = FALSE
). Forces object creation even if based_on
model is in the nm_dir("models")
directory.
An object of class nm_list
. Attributes can be viewed by printing
the object in the console.
The cmd
field uses glue
notation. So instead of specifying
execute runm1.mod -dir=m1
, it is best to specify execute {ctl_name} -dir={run_dir}
. The values of ctl_name
and run_dir
refer to object
fields and if these change value like when the child()
function is used to
create a separate child object, the cmd
field will update automatically.
Each field has a corresponding function (documented in nm_getsetters) of the same name to access and modify it's value.
The PsN run type. Default is execute
.
The run identifier. E.g. m1
.
The directory to copy control files and run NONMEM. Default = "Models".
For internal use.
Stores the contents of the control file to be written to disk when the
run_nm()
function is used on the object.
Path to the NONMEM ready dataset (from base project directory).
See details above.
Numbers of cores to use. Requires a cmd
value that uses the {cores}
glue field.
PsN directory to run the NONMEM run. Default is to the be the same as
the run_id
for simplicity.
Location to store results files from diagnostic reports executed with
nm_render()
.
For internal use.
Normally does not require setting. Path to the expected .lst file.
# create example object m1 from package demo files
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"))
m1 ## display object fields
#> List of 1
#> $ execute.Models/m1
#> ..$ type : chr "execute"
#> ..$ run_id : chr "m1"
#> ..$ run_in : chr "Models"
#> ..$ executed : logi FALSE
#> ..$ ctl_contents: chr collapsed - view with ctl_contents()
#> ..$ ctl_orig : chr collapsed - view with ctl_orig()
#> ..$ data_path : chr "/Users/runner/work/_temp/Library/NMproject/extdata/examples/theopp/SourceData/THEOPP.csv"
#> ..$ cmd : chr "execute runm1.mod -dir=m1"
#> ..$ cores : int 1
#> ..$ parafile : chr "path/to/parafile.pnm"
#> ..$ run_dir : chr "m1"
#> ..$ ctl_name : chr "runm1.mod"
#> ..$ results_dir : chr "Results"
#> ..$ unique_id : chr "execute.Models/m1"
#> ..$ lst_path : chr "m1/NM_run1/psn.lst"
#> ..- attr(*, "class")= chr [1:3] "nm_execute" "nm_generic" "list"
#> - attr(*, "class")= chr [1:2] "nm_list" "list"
cmd(m1)
#> [1] "execute runm1.mod -dir=m1"
ctl_name(m1)
#> [1] "runm1.mod"
run_dir(m1)
#> [1] "m1"