fitplot() broken
Hi,
When I run:
fit <- fitfromweb("nscod19_ass01")
fitplot(fit)
I was expecting to get a plot, but instead I get the following error:
Error in retape(set.defaults = FALSE) :
Error when reading the variable: 'constRecBreaks'. Please check data and parameters.
In addition: Warning message:
In retape(set.defaults = FALSE) : Expected object. Got NULL.
This is in the current version of stockassessment a233e88 (2019-10-30). When I install an old version 631fe00 (2019-03-13) the plot looks fine.
I'm running R 3.6.2 in Debian 10.
This happens when the data or parameters passed to TMB changes between versions. The nscod19_ass01 assessment was made with a version of the package that is too old.
You can update it by, e.g.:
fit2 <- runwithout(fit)
fitplot(fit2)
Maybe fitfromwebshould do this automatically?
I see. That's nifty, but far from obvious. Definitely useful.
The runwithout process can take a while, so it might be too much to run it every time a model is picked up using fitfromweb. An alternative approach could be to have fitfromweb examine the imported model (in a split second) and generate a helpful warning message when appropriate. Two approaches come to mind:
-
Compare
attr(fit,"Version")andpackageVersion("stockassessment"). Warn if they don't match. -
Compare
names(fit$conf)andnames(defcon(fit$data)). Warn if they don't match.
In both cases, the warning message could teach the runwithout trick to repair the version mismatch.
Three years later, I now get
fit <- fitfromweb("nscod19_ass01") fitplot(fit)
Error in .Call("MakeDoubleFunObject", data, parameters, reportenv, PACKAGE = DLL) :
Incorrect number of arguments (3), expecting 4 for 'MakeDoubleFunObject'
and
fit2 <- runwithout(fit)
Error in getParameterOrder(data, parameters, new.env(), DLL = DLL) :
Error when reading the variable: 'minWeek'. Please check data and parameters.
In addition: Warning messages:
1: In par[!names(par) %in% c("logN", "logF", "logSW", "logCW", "logitMO", :
number of items to replace is not a multiple of replacement length
2: In sam.fit(data, conf, par, rm.unidentified = TRUE, map = map, lower = fit$low, :
Initial values are not consistent, so running with default init values from defpar()
3: In getParameterOrder(data, parameters, new.env(), DLL = DLL) :
Expected object. Got NULL.
Is the recommended approach to install older versions of both TMB and SAM to browse the results from a previous assessment?