cameraOperation() error

109 views
Skip to first unread message

davidgeorg...@gmail.com

unread,
Jun 8, 2021, 11:38:00 PM6/8/21
to camtrapR
Jürgen

I got this advice  - I think it comes from 
Sample.op.st <- cameraOperation(CTtable = Sample.stns,
                            stationCol   = "StationDply",
                            setupCol     = "DateDeployed",
                            retrievalCol = "DateRetrieved",
                            writecsv     = FALSE,
                            hasProblems  = TRUE)

Error: LaTeX failed to compile Detection_Occupancy_Generic_DGN_V0.201.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Detection_Occupancy_Generic_DGN_V0.201.log for more info. In addition: Warning messages: 1: There are spaces in CTtable[, setupCol], but not in dateFormat 2: There are spaces in CTtable[, retrievalCol], but not in dateFormat 3: retrieval date is in the future. If this is not intended please check dateFormat 4: There are spaces in CTtable[, problemFromColumn], but not in dateFormat 5: There are spaces in CTtable[, problemToColumn], but not in dateFormat 

The log is not very helpful.

There are not spaces in my Station file dates (DateDeployed, DateRetrieved) because I have looked and because they are correctly POSIXct dates. There are hyphens but not spaces. There may likely be gaps in the times cameras were deployed at the same station which I identify as StationDply. What are "dateFormat 2:5?  Are they DateDeployed, DateRetrieved, Problem_From, Problem_to? If so where is "dateFormat 1"

The code ran correctly on a five station subset but here it is working on 2280 rows in a stations (CTtable) my StationDply data frame.

Thanks 
David

davidgeorg...@gmail.com

unread,
Jun 9, 2021, 1:23:10 AM6/9/21
to camtrapR
Jürgen

I am sorry to use your time.  I think this problem is because I use POSIXct date-times where you use dates or dates as characters. Certainly when I convert my dates in the CTtable to character date I no longer get the error/warning.

The reason my Rmd did not knit was because I produced an excessive long long table (of 2280 stations).

So issue closed.

David

davidgeorg...@gmail.com

unread,
Jun 9, 2021, 3:01:43 AM6/9/21
to camtrapR
Jürgen

I still get the Error: warning
"retrieval date is in the future. If this is not intended please check dateFormat"
Previously, the warning provided me with just two offending records. It took several goes to fix all of the offending records. 
Why do you only report two records, not all the offending records?

I am hopeful that the  Error: warning above with no specified records indicates that I have found all the out of bounds records where the Problem_to was greater than the DateRetrieved. Am I right in assuming that if the Problem_to is exactly equal to the DateRetrieved, I get the warning? 

Juergen Niedballa

unread,
Jun 12, 2021, 5:15:17 AM6/12/21
to camtrapR
Hi David, 
is this with version 2.0.3 or the newer github version(2.1)? It might help if you share str(Sample.stns) and the exact error messages and warnings you receive. I am confused by the Error: warning you report. 
For example, the warning regarding dates in the future. It is supposed to be a warning, not an error. Can you please confirm that's the case?

The condition that is checked is this: 
if(any(CTtable[,retrievalCol] > Sys.Date()))
So the warning is only raised if any entry in retrievalCol is later than the current system date. Given the number of stations you're combining maybe the formatting is inconsistent and some are misinterpreted? 

You can check that with the function camtrapR:::parseDateObject(). This is how it is used inside cameraOperation: 
parseDateObject(inputColumn = CTtable[,retrievalCol], dateFormat = dateFormat, checkNA = TRUE, checkEmpty = TRUE)

You can then check the range of the dates or plot them to identify problems. 

Regarding the last question (problem_to greater than retrieval): there is a dedicated error message for that "Problem ends after retrieval". And the error should only occur when retrieval is smaller than the problem end: 
if(any(CTtable[,retrievalCol] < CTtable[,cols.prob.to.index], na.rm = TRUE)) { # the error occurs}

And overall you're right, it would be better if camtrapR just natively supported POSIX columns. There are some problems with that in the current CRAN release that were fixed on github. So if you haven't yet please try the github version also. 

Last question. You said: 
"Previously, the warning provided me with just two offending records. It took several goes to fix all of the offending records. 
Why do you only report two records, not all the offending records?"
-> does that refer to this warning: "retrieval date is in the future. If this is not intended please check dateFormat""? The warning does currently not provide any details (details about the entries that causes the problem), so I suppose you are referring to some other problem? If possible please let me know the exact warning / error message and I'll check. 

Thank you and best regards,
Jürgen
Reply all
Reply to author
Forward
0 new messages