new_nm: Create a new (parent) nm object

Description Usage Arguments Details Value Object fields See Also Examples

View source: R/nm_object.R

Description

[Stable]

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.

Usage

1

Arguments

based_on

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).

run_id

Character. Run identifier. This is used to name the run and output files such as $TABLE outputs.

data_path

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.

cmd

Optional character. PsN command to use. If unspecified will use getOption("nm_default_fields") value of cmd. Use glue notation for inheritance. See details.

force

(Default = FALSE). Forces object creation even if based_on model is in the nm_dir("models") directory.

Details

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.

Value

An object of class nm_list. Attributes can be viewed by printing the object in the console.

Object fields

Each field has a corresponding function (documented in nm_getsetters) of the same name to access and modify it's value.

type

The PsN run type. Default is execute.

run_id

The run identifier. E.g. m1.

run_in

The directory to copy control files and run NONMEM. Default = "Models".

executed

For internal use.

ctl_contents

Stores the contents of the control file to be written to disk when the run_nm() function is used on the object.

data_path

Path to the NONMEM ready dataset (from base project directory).

cmd

See details above.

cores

Numbers of cores to use. Requires a cmd value that uses the {cores} glue field.

run_dir

PsN directory to run the NONMEM run. Default is to the be the same as the run_id for simplicity.

results_dir

Location to store results files from diagnostic reports executed with nm_render().

unique_id

For internal use.

lst_path

Normally does not require setting. Path to the expected .lst file.

See Also

nm_getsetters(), child()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# 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
cmd(m1)
ctl_name(m1)
run_dir(m1)

NMproject documentation built on Sept. 5, 2021, 5:43 p.m.