Error running R code on Linux computing cluster

Hi Johanna,

Here is the link for the solution:

First, I compiled the stan code without the data, directly on the management node and saved the compiled file with extension .RData. This takes few seconds.
Then, in the R file, I added a statement to call the compiled file. After that, you can submit the R file to the SLURM.

Here is my previous answer after the discussion with members of stan forums:

“ But I found a solution to get around the compilation error. First, I compiled the stan model, without data, on the “Management Server” and saved the compiled model with the extension .RData as follow:

sm ← stan_model(file = ‘a.stan’, save_dso = TRUE)
save(‘sm’, file = ‘sm.RData’)

Then, I submitted my R file to the SLURM and it works :)

The R file includes the following:

load(“sm.RData”)

… simulated data…

fit ← sampling(sm, data=list(K, N, J, y, dir_alpha ), pars=c(“pi”, “mu”, “theta”, “beta”, “alpha”, “prob”), warmup = 2000, iter = 5000, chains = 3)

Thanks a lot for everyone helped to solve this problem. Thanks for the Stan forums.”