-
Notifications
You must be signed in to change notification settings - Fork 9
Description
Workshop participant has done indirect survey of orangutan nests in multiple strata. She has stratum-specific nest decay rates (or mean persistence times). dht2 is supposed to be able to deal with this according to dht2 help:
You can use a multirow data.frame to have different rates for different geographical areas (for example). In this case the rows need to have a column (or columns) to
mergewith the data (for example Region.Label).
Applying the help instructions resulted in a cryptic error message for her; I created this minimum reproducible example, fabricating multipliers to apply to the minke two stratum data set shipped in the Distance package:
library(Distance)
data(minke)
mult.list <- list(creation=data.frame(Region.Label=c("North", "South"),rate=2, SE=1),
decay=data.frame(Region.Label=c("North", "South"), rate=c(0.5, 0.2), SE=c(0.1, 0.05)))
print(mult.list)
fitmod <- ds(minke, key="hr", truncation=1.5)
adjust.mult <- dht2(ddf=fitmod, flatfile = minke,
strat_formula = ~Region.Label, multipliers = mult.list)
Results in this error
Error in ii == "decay" && multipliers[[ii]]$SE != 0 :
'length = 2' in coercion to 'logical(1)'
Running in debug mode, I traced the error to line 60 in the function dht2_multipliers.
It is not clear what that line of code is trying to do. As an aside, although the help notes there needs to be a merge using the stratum labels, I could not find any merges taking place in this function, even though a comment early in the function states that a merge is about to happen.