@Bob_Carpenter is right that there aren’t any RDS files saved by default. Is it possible you’re referring to something else?
If you’re going to run many times in a loop I would lean towards using CmdStanR. It’s doable with RStan but it’s possible that keeping everything in memory in R is causing the issue (could be something else entirely though). CmdStanR will save (temporary, unless otherwise specified) CSV files each time you run it, but it won’t read them into memory in R until you use a method that requires them.
If you definitely want to use RStan I recommend not using the stan() function for this and instead using stan_model() to compile the model and then sampling() to run MCMC repeatedly with different datasets. Something like this:
model <- stan_model(file)
fits <- list()
for (n in 1:seq_along(datasets)) {
fits[[n]] <- sampling(model, data = datasets[[n]])
}
Although perhaps you’re already doing that. If the issue is running out of space when using RStan you could try Looping over many fits fills hard drive - #4 by sweenejo.
And, like @Bob_Carpenter said, it could be that in this particular case the issue isn’t the looping but that you’re running into some other issue, e.g. with specific seeds.