Hello,
I am fairly new to secr and I am trying to make a multi-session model using masks that are made with polygons that cover different sections of a given area. I have read through multiple of the pdf tutorials and I believe all my input data are correctly structured.
I’m using R version 4.3.1 and the secr package version 5.2.0
First, I made a capthist object with 3 sessions:
caps <- read.capthist(“captxy.txt",
trapfile = list("detector_1.txt", “detector_2.txt", "detector_3.txt"),
fmt = "trapID", detector = 'proximity', covnames = "Sex")
I then fitted three separate masks and list them:
Mask1 <- make.mask(traps(caps[[1]]), type = "polygon", spacing = 1500, poly = polygon1, poly.habitat = T)
Mask2 <- make.mask(traps(caps[[2]]), type = "polygon", spacing = 1500, poly =polygon2, poly.habitat = T)
Mask3 <- make.mask(traps(caps[[3]]), type = "polygon", spacing = 1500, poly =polygon3, poly.habitat = T)
Masks <- list(Mask1, Mask2, Mask3)
Next I used secr.fit:
model <- secr.fit(capthist = ‘caps’, mask =Masks, model = list(D~session, lambda0~t+bk, sigma~t+bk), detectfn = "HEX", trace = FALSE, method = "BFGS", CL = FALSE)
I get the following error:
no verify method for objects of class list
Error in if (notOK) stop("'verify' found errors in 'mask' argument") : argument is of length zero
The class of the “Masks” is list, but if I check the individual masks within the list using
class(Masks[[1]])
the class is “mask”.
I have tried restructuring the code so I list the masks as they are made:
masks2 <- list( Mask1 <- make.mask(traps(caps[[1]]), type = "polygon", spacing = 1500, poly = polygon1, poly.habitat = T),
Mask3 <- make.mask(traps(caps[[2]]), type = "polygon", spacing = 1500, poly =polygon2, poly.habitat = T),
Mask3 <- make.mask(traps(caps[[3]]), type = "polygon", spacing = 1500, poly =polygon3, poly.habitat = T))
However, I got the same error as above.
I’ve also tried using the make.mask function again on the list:
masks3<- make.mask(list( Mask1 <- make.mask(traps(caps[[1]]), type = "polygon", spacing = 1500, poly = polygon1, poly.habitat = T),
Mask3 <- make.mask(traps(caps[[2]]), type = "polygon", spacing = 1500, poly =polygon2, poly.habitat = T),
Mask3 <- make.mask(traps(caps[[3]]), type = "polygon", spacing = 1500, poly =polygon3, poly.habitat = T)))
This makes the “list” a “mask” object, but I go from having 15718 rows in mask1 to ~4000 rows. Thus, I believe I am losing data by doing it this way?
Also, if I run secr.fit without specifying the mask argument, it runs without issue. Therefore, I don’t think the capthist object is the problem.
I’m not sure what else to try to troubleshoot this problem!
Thanks in advance for any advice!
-Jayna