possible deSolve issue
Ran into an interesting issue during testing - I don't think this should be Bayes specific, but this is the code I ran and the error message I got:
sp <- function(split_dates) { replace(
specs(mm_name('bayes', err_proc_iid=FALSE),
n_cores=3, n_chains=3, burnin_steps=300, saved_steps=100, verbose=FALSE),
'split_dates', split_dates
) }
dat <- data_metab('1', res='30')
mm <- metab(sp(split_dates=FALSE), dat)
mm <- metab(sp(split_dates=TRUE), dat)
dat <- data_metab('3', res='30')
mm <- metab(sp(split_dates=FALSE), dat)
mm <- metab(sp(split_dates=TRUE), dat)
## Error in .Call("call_rkFixed", as.double(y), as.double(times), Func, Initfunc, :
## "call_rkFixed" not resolved from current namespace (deSolve)
## Error in .C("unlock_solver") :
## "unlock_solver" not resolved from current namespace (deSolve)
Sometimes it breaks on the third metab() call, sometimes on the fourth. It occurs whether I've compiled the stan code during this R session or a previous one.
From then on, I get the same error message anytime I try to run any Bayesian model, though an MLE works fine:
mm <- metab(sp(split_dates=FALSE), dat)
## Error in .Call("call_rkFixed", as.double(y), as.double(times), Func, Initfunc, :
## "call_rkFixed" not resolved from current namespace (deSolve)
## Error in .C("unlock_solver") :
## "unlock_solver" not resolved from current namespace (deSolve)
mm <- metab(specs('mle'), dat)
mm
## metab_model of type metab_mle
## [etc.]
mm <- metab(sp(split_dates=FALSE), dat)
## R session aborted
See
http://r.789695.n4.nabble.com/deSolve-unresolved-namespace-error-td4679888.html: The solution may be to call library(deSolve) before loading/running streamMetabolizer. But I don't want to add a CRAN-breaking code line (library()) until I'm sure it's necessary, so I'm waiting and just adding this issue for now.
Haven't seen the issue in a while. Might not even need the requireNamespace call now that deSolve is an official Depends package, but leaving as-is because it isn't currently broken
I just go this excat same error running a student's code on my computer. Worked for him, not me.
Error in .Call("call_rkFixed", as.double(y), as.double(times), Func, Initfunc, : "call_rkFixed" not resolved from current namespace (deSolve) Error in .C("unlock_solver") : "unlock_solver" not resolved from current namespace (deSolve)
Interesting. Does it help to call library(desolve); library(streamMetabolizer) as your very first calls in a fresh R session (with no automatically loaded data)?
I did not try calling library(desolve). A fresh R session solved the problem on its own. If this problem comes back, I will add library(desolve) to the code.