Create a new ferx model file from a skeleton template
Description
Writes a new .ferx file pre-filled with a skeleton for the chosen model type, then opens it in an editor. Pass print = TRUE instead of supplying a path to print the skeleton to the console without writing any file - useful for copy-pasting or piping in a scripted workflow.
Usage
ferx_model_new(
path = NULL,
template = "1cpt_oral",
overwrite = FALSE,
edit = TRUE,
print = FALSE
)Arguments
path: Path for the new.ferxfile. Must not already exist unlessoverwrite = TRUE. Ignored whenprint = TRUE.template: One of"1cpt_oral"(default),"1cpt_iv","2cpt_oral","2cpt_iv", or"ode".overwrite: Logical. Overwritepathif it already exists? Defaults toFALSE.edit: Logical. Open the file in an editor after writing? Defaults toTRUE. Ignored whenprint = TRUE.print: Logical. IfTRUE, print the skeleton to the console instead of writing a file. No file is created and no editor is opened. Defaults toFALSE.
Seealso
[ferx_model_edit](ferx_model_edit.qmd), [ferx_model_show](ferx_model_show.qmd), [ferx_model_set_section](ferx_model_set_section.qmd)Other model-editing: [ferx_get_section](ferx_get_section.qmd)(), [ferx_model](ferx_model.qmd)(), [ferx_model_edit](ferx_model_edit.qmd)(), [ferx_model_inspect](ferx_model_inspect.qmd)(), [ferx_model_section](ferx_model_section.qmd)(), [ferx_model_set_section](ferx_model_set_section.qmd)(), [ferx_model_show](ferx_model_show.qmd)(), [ferx_model_validate](ferx_model_validate.qmd)(), [ferx_set_section](ferx_set_section.qmd)()
Concept
model-editing
Value
path invisibly, or NULL invisibly when print = TRUE.
Examples
# Print a skeleton to the console (no file written, no editor opened)
ferx_model_new(print = TRUE)
ferx_model_new(template = "2cpt_iv", print = TRUE)
# Write a skeleton to a temp file and show it
tmp <- ferx_model_new(tempfile(fileext = ".ferx"), edit = FALSE)
ferx_model_show(tmp)
# Write a file and open it for editing
ferx_model_new("my_model.ferx")
# Write a file without opening an editor
ferx_model_new("my_model.ferx", edit = FALSE)