ferx_set_section.RdUpdates the body of a named section in a .ferx model file and
returns the input object so calls can be chained with |> or
%>%.
ferx_set_section(x, section, lines)x, invisibly. For a ferx_model pointing at a
bundled package file, the returned object's $model field will
point at the temp-directory copy that was actually edited.
When x is a ferx_model object the section is written to
x$model and x is returned invisibly, allowing further
pipe steps. Copy-on-write for bundled examples: if x$model
points to a file inside the installed ferx package directory
(typically the result of ferx_example()), the file is first
copied to tempdir() and x$model is updated to that copy
before the edit. This prevents accidental modification of read-only
package examples. When x is a plain path string the call is
equivalent to ferx_model_set_section(x, section, lines)
and the file is edited in place.
if (FALSE) { # \dontrun{
ex <- ferx_example("warfarin")
# Safe by default: editing a bundled example transparently copies the
# file to tempdir() and edits the copy. ex$model on disk is untouched.
fit <- ferx_model(ex$data, ex$model) |>
ferx_set_section("fit_options", c(
" method = focei",
" maxiter = 500",
" covariance = true"
)) |>
ferx_fit() |>
summary()
} # }