Error in loading .rds sim files
I have been running some simulations that are quite computationally lengthy (i.e. take >30min). The final sim objects have been working fine, with full functionality, including plotting. To store the simulations I used the code e.g. sim18$save("sim18.rds").
However, when loading the sim object with the code sim18<-PM_sim$new("sim18.rds"), the loaded sim returns errors when e.g. trying to plot from it.
So sim18$plot() returns the following when using the saved file:
Error in simout$obs[!is.na(simout$obs$out), ] : incorrect number of dimensions
However, re-running the sim and plotting from the freshly created sim file works with the same command.
I can obviously work around this, but raising in case this is a bug. If it is something I am doing incorrectly, advice would be appreciated.
Thanks for raising the issue!
There is obviously a bug here, but could you take a look at the simulated output (i.e. simout$obs) and see if it looks as what you would expect?
The issue seems to be that the whole environment is duplicated inside the sim$data object from the loaded .rds sim. See attached. Top image is the loaded .rds environment, whilst the bottom is the original. Indeed, the function works fine provided you use sim$data$plot() for sim$plot().
Instead of using PM_sim$new(), could you please try to load it using PM_sim$load()?
PM_sim$load() is deprecated, and only returns the following message without any functionality:
PM_sim$load()was deprecated in Pmetrics 2.1.0. ℹ Please use PM_sim$new() instead. ?PM_sim for details.