Hello, I need some help with text file inputs into read.capthist when my detector data has covariates. My detectors have both a covariate that varies across occasion (baited vs. non-baited), and a covariate that is constant across occasions (detector "type"). First year of my study had 5 occasions and varying effort across occasions.
I poured over both the data input and the varying effort vignettes, and was not sure whether the covariates should be a separate column from occasion effort, or in the same column as effort and separated by "/". Thus, I created two separate text files and tried read.capthist with both formats.
The first 5 lines of my two detector files look like this:
FILE "det_testA_txt3"
#Detector X Y Effort Covariates
1281-3COR15 401073 5264994 0 0 13 11 82 /B B B B NB/C
1281-4COR15 402931 5265632 10 12 0 0 58 /B B B B NB/C
1334-1COR15 401508 5264050 10 12 0 0 58 /B B B B NB/C
1334-3COR15 400382 5261316 0 0 13 11 41 /B B B B NB/C
1335-1COR15 406150 5262906 10 12 0 0 90 /B B B B NB/C
FILE "det_testA_txt4"
#Detector X Y Covariates
1281-3COR15 401073 5264994 0 0 13 11 82/B B B B NB/C
1281-4COR15 402931 5265632 10 12 0 0 58/B B B B NB/C
1334-1COR15 401508 5264050 10 12 0 0 58/B B B B NB/C
1334-3COR15 400382 5261316 0 0 13 11 41/B B B B NB/C
1335-1COR15 406150 5262906 10 12 0 0 90/B B B B NB/C
When I try to generate my capture history file, I keep receiving an error stating that the number of covariates doesn't match the number of columns:
> CH.a<- read.capthist("cap_testA_txt.txt", "det_testA_txt3.txt", detector = "proximity", fmt = c("trapID","XY"),
+ noccasions = 5, covnames="Sex", trapcovnames = c("Bait","Type"), binary.usage = FALSE)
Error in read.traps(file = "det_testA_txt3.txt", detector = "proximity", :
number of covariate names does not match number of columns 5
>
> CH.b<- read.capthist("cap_testA_txt.txt", "det_testA_txt4.txt", detector = "proximity", fmt = c("trapID","XY"),
+ noccasions = 5, covnames="Sex", trapcovnames = c("Bait","Type"), binary.usage = FALSE)
Error in read.traps(file = "det_testA_txt4.txt", detector = "proximity", :
number of covariate names does not match number of columns 5
>
I was able to proceed if I used a detector text file without the covariates, and successfully fit a variety of basic models (including sex-specific model) to familiarize myself with the software. why
> CH2<- read.capthist("cap_testA_txt.txt", "det_testA_txt3_NOCOV.txt", detector = "proximity", fmt = c("trapID","XY"),
+ noccasions = 5, covnames="Sex", binary.usage = FALSE)
No errors found
>
> summary(CH2)
Object class capthist
Detector type proximity
Detector number 83
Average spacing 2138.345 m
x-range 400382 430407 m
y-range 5237742 5265632 m
Usage range by occasion
1 2 3 4 5
min 0 0 0 0 0
max 14 14 16 17 123
Counts by occasion
1 2 3 4 5 Total
n 24 14 23 9 68 138
u 24 12 23 8 52 119
f 100 19 0 0 0 119
M(t+1) 24 36 59 67 119 119
losses 0 0 0 0 0 0
detections 24 14 23 9 71 141
detectors visited 19 14 15 7 45 100
detectors used 41 41 41 40 82 245
>
Could you please advise on why read.capthist won't accept my detector covariates? Thank you.