modify_records | R Documentation |
NONMEM
control stream fileModify or retrieve options and records from a NONMEM
control stream file
get_model_ctl(.mod)
get_records(.mod, type, get_lines = FALSE)
mod_has_record(.mod, type)
remove_records(.mod, type)
add_new_record(
.mod,
type,
rec_name = paste0("$", toupper(type), " "),
lines = NULL,
after = NULL
)
modify_data_path_ctl(.mod, data_path)
modify_prob_statement(.mod, prob_text = NULL)
get_input_columns(.mod, from_data = TRUE)
get_table_columns(.mod, from_data = TRUE)
.mod |
a bbr model object |
type |
record type. This may be spelled any way that's accepted in a
|
get_lines |
Logical (T/F). If |
rec_name |
a character string defining the record name (e.g., |
lines |
a character string or vector of lines to append to the new
record. If passing a vector, creates a new line per index. Defaults to |
after |
add new record after this record type. This may be spelled
any way that's accepted in a |
data_path |
Data path to set in a |
prob_text |
If |
from_data |
Logical (T/F). If |
get_model_ctl()
is called internally within the other functions, though
it can also be used outside of that context.
modify_prob_statement()
, modify_data_path_ctl()
,
remove_records()
, and add_new_record()
read in the control stream,
make any modifications, and then save out the updated control stream.
modify_prob_statement()
also returns a character string defining the
$PROBLEM
text (see prob_text
argument).
mod_has_record()
will return a logical value denoting whether a bbr
model has a given record type.
get_records()
extracts all records of a given type. Note that it is
not meant to be used to modify existing records.
get_input_columns() and get_table_columns() extract the column names
of the input data and all table files respectively. They can either be parsed
from a NONMEM
control stream file, or determined from reading in the
csvs
/table files. See from_data
argument for more details.
get_model_ctl()
: Read in a NONMEM
control stream file, parsed via
nmrec
get_records()
: Pull all records of a given record type from a
bbr
model
mod_has_record()
: Check if a bbr
model has a given record type
remove_records()
: Remove all records of a given type from a NONMEM
control stream file
add_new_record()
: Add a new record of a given type from a NONMEM
control stream file
modify_data_path_ctl()
: Modify the specified data path in a NONMEM
control stream file
modify_prob_statement()
: Modify or retrieve the $PROBLEM
statement from
a NONMEM
control stream file.
get_input_columns()
: Retrieve input data column names from either the
$INPUT
record in a NONMEM
control stream file or the input dataset.
get_table_columns()
: Retrieve table columns names from either $TABLE
record(s) in a NONMEM
control stream file or the tabled out files
Run the following command to see what record types are available/supported by
nmrec
:
`ls(nmrec:::record_names)`
assert_record_type()
## Not run:
# Adding a new record
seed <- 1234; n <- 100
sim_lines <- glue("({seed}) SUBPROBLEMS={n} TRUE=FINAL ONLYSIMULATION")
add_new_record(.mod, "simulation", lines = sim_lines, after = "pred")
# Remove all records of a given type
if(mod_has_record(.mod, "table")) remove_records(.mod, "table")
# Modify or extract a problem statement
modify_prob_statement(.mod, prob_text = NULL)
#> [1] "PK model 1 cmt base"
modify_prob_statement(.mod, prob_text = "new problem")
#> [1] "new problem"
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.