Skip to content

mod$variables() fails with includes if the model is not compiled first #680

Closed
@rok-cesnovar

Description

@rok-cesnovar

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions