griffithdan / cooccur

Probabilistic Species Co-occurrence Analysis in R
3 stars 6 forks source link

error on site_mask argument #12

Open fhafarache opened 2 years ago

fhafarache commented 2 years ago

Hello,

I have been trying to analyze species occurrence with site masks, but I keep receiving error messages as in the example below:

` data <- t(data.frame( sp1 = c(1,1,1,1,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0), sp2 = c(1,0,1,1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0), sp3 = c(0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,1,1,1,0), sp4 = c(0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,1,1,1,1,1)))

colnames(data) <- paste0("site", 1:20)

mask <- t(data.frame(sp1 = c(1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0), sp2 = c(1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0), sp3 = c(0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1), sp4 = c(0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1)))

colnames(mask) <- paste0("site", 1:20)

library(cooccur) occur1 <- cooccur(data,site_mask = mask, type = "spp_site", thresh = TRUE, spp_names = TRUE) ` Error in rep(x = 0, times = psite) : invalid 'times' argument

Are there any issues on "site_mask", or am I missing the point on how to use it?

Thanks in advance!

Screen Shot 2022-06-03 at 10 58 39
ErikKusch commented 2 years ago

Hiya - this issue is fixed with my pull request #6. @griffithdan, please merge it. It seems many of the open issues can be traced back to the bug I fix in #6. @fhafarache, for the time being, you can get the desired functionality of cooccur by reinstalling it from my repo using this code: devtools::install_github("ErikKusch/cooccur").