Page 1 of 1

Extracting data from capthist object

PostPosted: Sat Oct 28, 2017 12:31 pm
by jhumm
Hello,

I am trying to run some models in package secr to determine the extent of introduced bias from subsampling of hair sample data for a spatially explicit black bear population estimate. I have simulated a trap array and a population in secrdesign, and I have simulated a capthist object from these data. My next goal is to randomly remove captures from the generated capture history in order to simulate the subsampling strategies we are hoping to use, and then to compare model parameter estimates using these modified capture histories. Is it possible to extract relevant data from a capthist object (capture location, capture occasion, animal ID, and sex) for export to a text file or database? Any assistance with this question would be greatly appreciated.

Sincerely,

Jake Humm

Re: Extracting data from capthist object

PostPosted: Sat Oct 28, 2017 3:40 pm
by jhumm
I figured it out, sorry for the post. 'write.capthist' works just fine.

Re: Extracting data from capthist object

PostPosted: Sun Oct 29, 2017 7:12 am
by egc
This should be in the 'secr' subforum, so I'm moving this thread over.

Re: Extracting data from capthist object

PostPosted: Sun Oct 29, 2017 4:01 pm
by murray.efford
Thanks Evan.

Regarding the original post - Do you have a need to export the data? Wouldn't it be simpler to use the subset method? For example, using the builtin data set captdata and selecting 50 traps at random on occasions 1-3:
Code: Select all
randomtraps <- sample.int(dim(captdata)[3], size = 50, replace = FALSE)
CH2 <- subset(captdata, traps = randomtraps, occ = 1:3)
secr.fit(CH2)

Murray

Re: Extracting data from capthist object

PostPosted: Fri Jan 10, 2020 8:13 pm
by jhumm
Thank you Murray, yes that would be easiest! Sorry for the 2-year-late reply, and thanks for the advice!