trap availability

questions concerning anlysis/theory using program DENSITY and R package secr. Focus on spatially-explicit analysis.

trap availability

Postby bear16 » Thu Sep 13, 2012 1:49 pm

Hello,

I want to apologize in advance because I am a novice with R so this quite possibly is a problem on that end.

I was excited to find the option to include when particular detectors were not operated because we were not able to keep all the traps open during all years of our study (and some were closed during particular occasions within a year due to inaccessibility). This would allow me to include a data file with all three sessions, but indicate the somewhat different trapping array each time. However, when I attempt to run it, I get this error message:
Session 1
Conflicting number of occasions in usage matrix
capthist : 5 occasions
usage(traps(capthist)) : 15 occasions
Session 2
Conflicting number of occasions in usage matrix
capthist : 5 occasions
usage(traps(capthist)) : 15 occasions
Session 3
Conflicting number of occasions in usage matrix
capthist : 5 occasions
usage(traps(capthist)) : 15 occasions

My data files has the lines:
Trap X Y trap availability
a # # 0000011111011111

My code was:
myCH<-read.capthist("traphistoryf.txt","traplocation.txt", detector="multi", fmt="trapID", covnames = "sex", verify = TRUE)


I have three primary occasions/years and 5 secondary occasions/trapping weeks within year. I thought perhaps I needed a space between the trap availability for primary sessions, but then got:
Error in read.traps(file = "traplocation.txt", detector = "multi", :
'usage' fields suggest varying number of occasions

How do I need to adjust my data file and/or code to correct this?

Thank you!
bear16
 
Posts: 20
Joined: Thu Oct 14, 2010 11:18 am

Re: trap availability

Postby murray.efford » Thu Sep 13, 2012 9:43 pm

You need a separate 'traps' object for each of the 3 sessions, each with just 5 'usage' codes. I don't think read.capthist() covers this case, so you need to use make.capthist() directly; this demands slightly more familiarity with R. make.capthist() accepts a traps argument that is itself an R list of traps objects... I can provide example code if you send me some raw data offline. This is harder than it needs to be, and I see a way I can tweak secr to make it easier, for the next version.
Murray
murray.efford
 
Posts: 712
Joined: Mon Sep 29, 2008 7:11 pm
Location: Dunedin, New Zealand

Re: trap availability

Postby murray.efford » Fri Sep 14, 2012 6:09 pm

As long as you are willing to prepare a separate trap file for each session (year), read.capthist() will handle this case just fine. Provide the names of the session-specific trap files as a character vector in the trapfile argument, for example
Code: Select all
myCH <- read.capthist("traphistoryf.txt", c("traplocation1.txt", "traplocation2.txt", "traplocation3.txt"), detector="proximity")

This is mentioned on p.6 of secr-datainput.pdf (available e.g. from ?secr).

The next version of secr will also include an option in the split method for traps objects to be split 'byoccasion', useful where the usage codes span more than one session. In your case would be used to make a a multi-session traps object with usage for 5 occasions in each session. It's easier, however, to start out with separate text files as you can then use read.capthist rather than messing with make.capthist.
Murray
murray.efford
 
Posts: 712
Joined: Mon Sep 29, 2008 7:11 pm
Location: Dunedin, New Zealand


Return to analysis help

Who is online

Users browsing this forum: Google [Bot] and 0 guests

cron