camtrapR detectionHistory error - probably due to byCamera

235 views
Skip to first unread message

Heidi H

unread,
Oct 21, 2016, 3:54:08 AM10/21/16
to unmarked
This is what I was running:
DetHist1 <- detectionHistory(recordTable         = recordtable,
                            camOp                = camop_no_problem,
                            stationCol           = "Station",
                            speciesCol           = "Species",
                            recordDateTimeCol    = "DateTimeOriginal",
                            species              = "Chrotogale owstoni",
                            occasionLength       = 7,
                            day1                 = "station",
                            includeEffort        = FALSE,
timeZone             = "Asia/Bangkok"
)


ERROR:
Error in detectionHistory(recordTable = recordtable, camOp = camop_no_problem,  : 
  Not all values of stationCol in recordTable are matched by rownames of camOp

I believe it's because my camop_no_problem was created with the variable byCamera as I had more than one camera at each station. So the camop_no_problem first column looks like this:
TrapName_CameraName 

while my recordtable Station column only has 
TrapName

Can I still run the detectionHistory command, and if so, what do I need to do?

Juergen N

unread,
Dec 20, 2016, 6:52:56 AM12/20/16
to unmarked
Hi Heidi,

this is indeed a limitation in the current release of camtrapR, but here's a simple workaround.


You wrote:

I believe it's because my camop_no_problem was created with the variable byCamera as I had more than one camera at each station. So the camop_no_problem first column looks like this:
TrapName_CameraName 

while my recordtable Station column only has 
TrapName

This is exactly what is happening here. So you
could create a new column in recordTable which combines station and camera IDs and corresponds to the values stationCol of recordTable. Can be achived by:

recordtable$StationCam <- paste(recordtable$Station, recordTable$Camera, sep = "_")

Afterwards, the IDs should match and detectionHistory should be happy. Please note that from camtrapR 0.99.6 (on CRAN since 20 Dec 2016) station and camera IDs are separated by 2 underscores ("__") to prevent problems in case you have underscores in your station or camera IDs.

But even if you have more than 1 camera at a station, you may wish to consider treating them as one station by setting byCamera = FALSE in function "cameraOperation" (e.g. if 2 cameras faced each other).

Jürgen
Reply all
Reply to author
Forward
0 new messages