Closed
Description
See comments in the example:
library(cmdstanr)
data_code <- "
data {
int N;
}
"
data_file <- write_stan_file(code = data_code, basename = "data.stan")
model_code <- "
#include data.stan
parameters {
vector[N] y;
}
model {
y ~ std_normal();
}
"
model_file <- write_stan_file(code = model_code)
mod <- cmdstan_model(
stan_file = model_file,
include_paths = dirname(data_file),
compile = FALSE
)
mod$variables() #this fails
mod$compile()
mod$variables() # this works