A parsed nmrec_record object has a populated "values" field that includes nmrec_option objects. This function is a convenience wrapper for grabbing a specified option. If the option occurs multiple times in the record, an error is signaled.
get_record_option(record, name)
An nmrec_record object.
Name of option to select. Any valid spelling of the option name is allowed.
Note that a record also stores the record type (e.g., "$EST") as an
nmrec_option object (specifically an nmrec_option_record_name
object).
This "option" won't usually be of interest, but, if you do want to grab it
with get_record_option()
, you need to pass the full type as name
(e.g.,
"estimation" rather than "est").
select_records()
for selecting records of a given type.
ctl <- parse_ctl(nmrec_examples[["bayes1"]])
ests <- select_records(ctl, "est")
# Get method for first estimation record.
meth1 <- get_record_option(ests[[1]], "meth")
meth1$value
#> [1] "ITS"