detectionHistory not recognizing non-operational camera days

72 views
Skip to first unread message

Travis King

unread,
Nov 18, 2022, 4:19:29 PM11/18/22
to camtrapR
Running a basic detectionHistory in which my camop has errors. Output on camop is recognizing the hasProblems argument correctly and is outputing 0s for days of camera non-operational. However when run in detectionHistory non-operational dates are being counted as 0 (no detection) rather then NA (non-operational). Updated all versions of R, R studio, and packages, including lubridate and camtrapR. The same error occurs. Reran code with no max date and day1 as survey rather then station. The same error occurs. Attempted on several computers with no luck. Code:

camop <- cameraOperation(cameras, stationCol="Station", setupCol="Setup_date", retrievalCol="Retrieval_date", hasProblems = TRUE, dateFormat="%m/%d/%Y")

BlueGrouse_1day <- detectionHistory(
  recordTable = turkeygrouse1,
  species = "Blue Grouse - High",
  camOp = camop,
  stationCol = "Station",
  speciesCol = "Species",
  recordDateTimeCol = "DateTimeOriginal",
  occasionLength = 1,
  day1 = "station",
  maxNumberDays=120,
  includeEffort = FALSE,
  writecsv=TRUE,
  outDir="C:/Users/Home/Documents/2022 Summer Work/MSEC Projects TurkeyGrouse Detection Histories by Camera_200mBuff"
)

BlueGrouse_1day <- detectionHistory(
  recordTable = turkeygrouse1,
  species = "Blue Grouse - High",
  camOp = camop,
  stationCol = "Station",
  speciesCol = "Species",
  recordDateTimeCol = "DateTimeOriginal",
  occasionLength = 1,
  day1 = "survey",
  includeEffort = FALSE,
  writecsv=TRUE,
  outDir="C:/Users/Home/Documents/2022 Summer Work/MSEC Projects TurkeyGrouse Detection Histories by Camera_200mBuff"
)

Any help would be greatly appreciated as I've run this code many times before without issue.

Juergen Niedballa

unread,
Nov 20, 2022, 9:17:44 AM11/20/22
to camt...@googlegroups.com

Hi Travis,

this seems to be a bug related to occasionLength = 1, and doesn't happen with any higher values of occasionLength. I'll add it to the to-do list.

For time being you can set all cells in detection history which have 0 effort to NA via something like:

dethist$detection_history[dethist$effort == 0]  <- NA

Best regards,

Jürgen

--
You received this message because you are subscribed to the Google Groups "camtrapR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camtrapr+u...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/camtrapr/aaf879d0-c2e5-4b22-8477-3921233a1383n%40googlegroups.com.

Ray Hunter

unread,
Aug 2, 2023, 3:03:11 PM8/2/23
to camtrapR
Hi Jürgen,

I have been having this same issue when setting the occasionlength = 1. Has this been updated yet or is using 

dethist$detection_history[dethist$effort == 0]  <- NA

still the best option?

Thanks,
Ray 

Jürgen Niedballa

unread,
Aug 2, 2023, 11:03:50 PM8/2/23
to Ray Hunter, camtrapR
Hi,
I just uploaded a fix to the GitHub version. Please install from github and let me know if there are any issues.
Best,
Jürgen



Reply all
Reply to author
Forward
0 new messages