ferx_model_validate.RdParses a .ferx model file using the Rust engine and checks for
required sections, without running the optimizer. Useful for catching
syntax errors and missing sections before committing to a long estimation
run.
ferx_model_validate(path)TRUE if the model file is structurally valid (all required
sections present and the Rust parser accepts it), FALSE otherwise,
invisibly. The function always prints a report to the console. Note that
a missing file or non-.ferx extension raises an error rather than
returning FALSE — pass an existing .ferx path.
# Valid model — all required sections present
ex <- ferx_example("warfarin")
ferx_model_validate(ex$model)
#> Validating: warfarin.ferx
#>
#> Sections present:
#> parameters [ok]
#> individual_parameters [ok]
#> structural_model [ok]
#> error_model [ok]
#> fit_options [ok] (optional)
#>
#> Result: VALID
if (FALSE) { # \dontrun{
# Invalid model — missing required sections
bad <- tempfile(fileext = ".ferx")
writeLines(c(
"[parameters]",
" theta TVCL(1.0, 0.001, 100.0)",
"[structural_model]",
" pk one_cpt_oral(cl=CL, v=V, ka=KA)"
), bad)
ferx_model_validate(bad)
# Validating: <file>.ferx
#
# Sections present:
# parameters [ok]
# individual_parameters [MISSING]
# structural_model [ok]
# error_model [MISSING]
#
# Result: INVALID
# * Missing required section: [individual_parameters]
# * Missing required section: [error_model]
} # }