Returns the contents of a block in a stan model as a character vector of lines.

get_block(x, name, shell = FALSE)

Arguments

x

a stanedit object

name

name of the block

shell

if TRUE (default:FALSE), will return the shell (i.e., the definition of the block) as well as content; this is useful, e.g., to see options passed to a transition or ode block

Value

a character vector of the lines in the block, or an empty character vector if the block is not found

Examples

model_file_name <- system.file(package = "stanedit", "regression.stan")
reg <- stanedit(filename = model_file_name)
get_block(reg, "parameters")
#> [1] "real alpha;"          "real beta;"           "real<lower=0> sigma;"