DOI-USGS / DOI-USGS/streamMetabolizer

possible deSolve issue

Open
#225 4 comments 1 reaction 0 assignees View on GitHub
Dominant language
Stan
Stars
47
Forks
25
PR merge metrics
No merged PRs in 30d

Description

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:

``` r
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:

``` r
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.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the repeated metab() calls and the deSolve namespace errors, then compare behavior with and without library(deSolve) before loading or running streamMetabolizer. Inspect the Bayesian metab path and deSolve interaction; done means identifying the cause and documenting or testing a project-safe resolution without assuming that library() is appropriate.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.