Inserts one or more lines into a libbi model. If one of before or after is given, the line(s) will be inserted before or after a given line number or block name, respectively. If one of at_beginning of or at_end_of is given, the lines will be inserted at the beginning/end of the block, respectively.

insert_lines(x, lines, before, after, at_beginning_of, at_end_of)

Arguments

x

a stanedit object

lines

vector or line(s)

before

line number before which to insert line(s)

after

line number after which to insert line(s)

at_beginning_of

block at the beginning of which to insert lines(s)

at_end_of

block at the end of which to insert lines(s)

Value

the updated stanedit object

See also

Examples

model_file_name <- system.file(package = "stanedit", "regression.stan")
reg <- stanedit(filename = model_file_name)
insert_lines(reg, lines = "alpha ~ std_normal();", after = 12)
#> data {