Returns the lines belonging to a named section of a .ferx model file, excluding the section header itself. Prints the lines to the console and returns them invisibly.

ferx_model_section(path, section, strip = FALSE)

Arguments

path

Path to a .ferx model file.

section

Name of the section to extract, without brackets (e.g. "parameters").

strip

Logical. If TRUE, leading whitespace is trimmed from each returned line via trimws. Defaults to FALSE to preserve the round-trip guarantee with ferx_model_set_section.

Value

Character vector of lines in the requested section, invisibly.

Examples

ex <- ferx_example("warfarin")
ferx_model_section(ex$model, "parameters")
#> # [parameters]
#>   theta TVCL(0.134, 0.001, 10.0)
#>   theta TVV(8.1, 0.1, 500.0)
#>   theta TVKA(1.0, 0.01, 50.0)
#> 
#>   omega ETA_CL ~ 0.07
#>   omega ETA_V  ~ 0.02
#>   omega ETA_KA ~ 0.40
#> 
#>   sigma PROP_ERR ~ 0.01
#> 
#> 
ferx_model_section(ex$model, "parameters", strip = TRUE)
#> # [parameters]
#> theta TVCL(0.134, 0.001, 10.0)
#> theta TVV(8.1, 0.1, 500.0)
#> theta TVKA(1.0, 0.01, 50.0)
#> 
#> omega ETA_CL ~ 0.07
#> omega ETA_V  ~ 0.02
#> omega ETA_KA ~ 0.40
#> 
#> sigma PROP_ERR ~ 0.01
#> 
#>