Hi everyone
I’m also getting “R session Aborted R encountered a fatal error” on my Mac OS repeatedly…
My code is quite complicated… I have Stan models in one function and use that function in a for loop… After several successful samplings, I’ll encounter this “R session aborted” issue and everything is gone…
Here is my codes: https://github.com/yup958/BOISE.git
And this is how I encounter the problem:
set.seed(2154)
library(rstan)
options(mc.cores = parallel::detectCores())
rstan_options(auto_write = TRUE)
load(“BOISE_test1.RData”)
source(“dpmm.R”)
source(“pel1.R”)
high_hit = which(apply(dat,2,sum)>15)
clust1 = sample(which(cl$C == 1), 16)
clust2 = sample(which(cl$C == 2), 8)
clust3 = sample(which(cl$C == 3), 8)
subdat = dat[c(clust1,clust2,clust3), high_hit]
cl = dpmm(subdat,a = 2, aux = 2, iter = 100)
pel_value = rep(0, length(high_hit))
for (i in 1:20) {
A = i
nA = 1
nT = 2
pel_value[i] = pel1(A, nA, nT, cl, subdat)
}
Everything is fine except for the last step… After 2-4 iterations this issue will happen…
I was thinking this may be caused by RAM excess but I don’t know how to get rid of it… Can anyone help me out? Thanks a lot!