rbchan / unmarked

R package for hierarchical models in ecological research
https://rbchan.github.io/unmarked/
36 stars 25 forks source link

nonparboot fails when unmarkedFrame doesn't include covariate #92

Closed rbchan closed 5 years ago

rbchan commented 8 years ago

the code below results in an error from function nonparboot:

# OPTION 1
data(frogs)
pferUMF <- unmarkedFrameOccu(pfer.bin)
fm <- occu(~ 1 ~ 1, pferUMF)
nonparboot(fm,B=4)
Error in eval.quoted(.variables, data) : 
  envir must be either NULL, a list, or an environment.

This however runs:

# OPTION 2 
data(frogs)
pferUMF <- unmarkedFrameOccu(pfer.bin)
siteCovs(pferUMF) <- data.frame(sitevar1 = rnorm(numSites(pferUMF)))  # site covariates
obsCovs(pferUMF) <- data.frame(obsvar1 = rnorm(numSites(pferUMF) * obsNum(pferUMF))) # observation covariates
 fm <- occu(~ 1 ~ 1, pferUMF)
nonparboot(fm,B=4)

So it seems that, to use function nonparboot with an object from occu, one needs to have defined covariates, even if they are not used.

kenkellner commented 5 years ago

Fixed in #122