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

get_declaration(x, name)

Arguments

x

a stanedit object

name

name of the variable

Value

a character vector of length 1 with the line where the variable is declared, or an empty character vector if no declaration is found

Examples

model_file_name <- system.file(package = "stanedit", "regression.stan")
reg <- stanedit(filename = model_file_name)
get_declaration(reg, "alpha")
#> [1] "real alpha;"