kaitlyngaynor / gorongosa-mesocarnivores

2 stars 0 forks source link

detection history error message #102

Closed klg-2016 closed 3 years ago

klg-2016 commented 3 years ago

https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/blob/0da21232c819bc94bca59702867c1805ff1c8baa/scripts/multi-season%20model/01-multi-season-data-prep.R#L41

This chunk of code to make the detection history yields the following error message: recordTable was converted from tibble to data.frame Error in if (any(date_ranges2$start_first_occasion > date_ranges2$end_last_occasion)) { : missing value where TRUE/FALSE needed In addition: There were 30 warnings (use warnings() to see them)

The warnings are all this: In min(which(!is.na(X))) : no non-missing arguments to min; returning Inf

I googled the error message and I'm thinking this might be the result of 12 cameras being taken down for the second season? does that sound reasonable? If so, would the move be to exclude those cameras across the board so we have comparable data sets going into the model?

klg-2016 commented 3 years ago

filter_all(any_vars(!is.na(.))) %>% #delete cameras that were inoperational during this period (all NAs)

I used the above line of code (around line 29 if I don't change anything before pushing again) to removes rows that only contained NAs, and now I can create a detection history. One question from that removal, though: I thought 12 cameras were taken down from the first to second seasons? I checked manually to see if the code is doing what I think it should be doing, and I think it correctly removed 15 cameras from the data frame. Does that make sense?

kaitlyngaynor commented 3 years ago

Hmm. I do think it was only 12, BUT there may have been another 3 cameras that were inoperable in this period (I seem to remember there was one camera that we forgot to turn on...). I would check against the raw, original camera operation dates to see if this makes sense. Have a look at the start/end/problem dates for the cameras that it's dropping just to double check.

klg-2016 commented 3 years ago

Got it, I'll check the raw data!

klg-2016 commented 3 years ago

okay checking "Camera_operation_years1and2.csv", all 15 of those cameras are correctly not be included in the 2017 late dry season based on end dates. some of them have an end date of June or July 2017.