Closed iantaylor-NOAA closed 2 years ago
Ian -- do you have a shorter reproducible example? I have all these packages updated, but the script crashes out for me in a few places before getting to the sdmTMB call (e.g. 'species' not found at the start of the loop). Or send the R image you're working with?
formula can be a formula, but also a list for delta models -- but I can see what the issue might be
I my be off base here, but I am unclear as to what line 39 returns when you run the script in the original issue. Do you mean that it returns a list:
> formula
[[1]]
catch_mt ~ 0 + as.factor(Year) + pass_scaled + (1 | vessel_scaled)
[[2]]
catch_mt ~ 0 + as.factor(Year) + pass_scaled + (1 | vessel_scaled)
or is it just returning
[1] "list"
Although there is addition code that could modify the formula call after line 39, the returned object should be a list of length two with the same formula for each element. If you are getting the correct list then ignore this comment.
Is it possible you have an old version of sdmTMB? At one point formula had to be a formula. Now it can be a formula or list of formulas (if you want different formulas for 2 delta model components).
Thanks everyone for coming to my rescue! @seananderson, you hit the nail on the head. That's embarrassing. I had sdmTMB version 0.0.21.9004 which seems to be from March 1, 2022. I didn't recall installing it and just assumed it was newly installed along with the other packages I added recently.
The update is taking a while and I need to quit for the day but will assume that the newer version will solve the issue.
In case they are useful for other purposes, I just pushed the changes required to source the script on my computer (sorry @ericward-noaa, I clearly left a few out). Sourcing the modified file initially reproduced the error and will hopefully now reproduce the lack of error. The commit to a fork is here: https://github.com/kellijohnson-NOAA/indexwc/compare/main...iantaylor-NOAA:indexwc:debug_issue_4.
Follow-up: updating sdmTMB indeed resolved the problem. Sorry for the confusion.
Is there an existing issue for this?
Current Behavior
Based on suggestion via chat with @kellijohnson-NOAA and @chantelwetzel-noaa, I've been working through
sandbox/run_index_comparison.R
. The call to sdmTMB in these lines https://github.com/kellijohnson-NOAA/indexwc/blob/main/sandbox/run_index_comparison.R#L209-L227 is producing the errorError: class(formula) not identical to "formula"
I note that running
class(formula)
(on formula object created starting on line 39 of the file) returns[1] "list"
Any suggestions?Expected Behavior
A successful completion of the sdmTMB estimation.
Steps To Reproduce
dev
branch of VAST required to get VAST_v14_0_1setwd()
command to point to sandbox on my local computersource("my_apply_epsilon.R")
near the top to make that function availablerecursive = TRUE
todir.create(dir, showWarnings = FALSE, recursive = TRUE)
on line 91Environment
Anything else?
No response