stanedit prepares stan model code for programmatically editing.

stanedit(object, filename)

Arguments

object

either a stanmodel object as generated by rstan::stan_model() or a CmdStanModel object as generated by cmdstanr::cmdstan_model(), or a character vector representing model code.

filename

name of a file containing model code, if object is not given.

Value

A {stanedit} object containing clean model code. This will have some formatting applied to it for further processing so line numbers may not correspond to the original model, and comments will be removed.

Examples

model_file_name <- system.file(package = "stanedit", "regression.stan")
reg <- stanedit(filename = model_file_name)
reg
#> data {