Generate NLME Model Template from JSON Specification
output_NLMETemplate.Rd
This function serves as a command-line argument parser that calls an
internal function (output_NLMETemplateInternal
) to generate NLME (Non-Linear
Mixed Effects) model templates. It takes a series of "key=value" pairs,
processes a detailed JSON model specification, and outputs a model template
file and a corresponding tokens file, which can be used for model fitting.
Arguments
- args
A character vector where each element is a string in the format "key=value". The function parses these strings to set up the model generation process. The following keys are expected:
model_setup
: The file path to the input JSON file that defines the NLME model structure, parameters, covariates, and error models.template_path
: The destination file path for the output model template.tokens_path
: The destination file path for the output JSON tokens file.data_path
: The file path to the dataset that will be used with the model.author
: A string specifying the name of the author to be embedded in the output files.description
: A string providing a description of the model to be embedded in the output files.
Value
This function does not return a value to the R environment. It is executed for its side effect of writing two files:
A model template file to the location specified by
template_path
.A tokens JSON file to the location specified by
tokens_path
.
See also
The core logic is handled by the internal function output_NLMETemplateInternal
.
The final file writing is performed by write_ModelTemplateTokens
.
Examples
if (FALSE) { # \dontrun{
# Example of the arguments that would be passed to the function.
# In a real scenario, these might come from a command-line call.
arguments <- c(
"model_setup=./model_definition.json",
"template_path=./template.txt",
"tokens_path=./tokens.json",
"data_path=./pk_data.csv",
"author=Jane Doe",
"description=2-compartment PK model with first-order absorption and linear elimination"
)
# Execute the function with the defined arguments
output_NLMETemplate(args = arguments)
} # }