Add a block to a stan model. If that block exists, it will be removed first.

add_block(x, name, lines)

Arguments

x

a stanedit object

name

name of the block

lines

character vector, lines in the block

Value

a stanedit object containing the new block

Examples

model_file_name <- system.file(package = "stanedit", "regression.stan")
reg <- stanedit(filename = model_file_name)
reg <- add_block(
  reg,
  "transformed parameters",
  c("real gamma;", "gamma = alpha * beta;")
)
#> Warning: Nothing to remove.