I’m trying to use the feature
as_cmdstan_mcmc to recreate a fit object, for which I saved the csv files. (I tried saving it as an RDS file but R’s memory ran out.)
I would like to reconstruct the fit object, but
as_cmdstan_mcmc() is not found as a function. Note that the same error appears in the example vignette: Read CmdStan CSV files into R — read_cmdstan_csv • cmdstanr
Yeah, looks like the docs are just wrong; the
_mcmc version must be an outdated name.
Yes, this works. I did have to sort through some memory issues with Rstudio but this seems independent of cmdstanr.
I don’t understand why it takes so long (and also so much memory) to read the csv file into a fit file, with as_cmdstan_fit, when just reading the csv file doesn’t seem to cause any issue.
Can you make an issue for your RAM observations?
The issue comes from combining multiple chains in a R object. By default we combine them to R arrays which is a bit memory intensive (due to how R works mostly).
When dealing with large number of parameters use:
fit <- as_cmdstan_fit(files, format = "draws_list")
Yes, I’ll try and write something later today, though I think @rok_cesnovar 's comment is spot on.