Getting independent records based on a already created record table

220 views
Skip to first unread message

Emeline Auda

unread,
Jun 2, 2022, 1:16:22 PM6/2/22
to camtrapR
Hi all,

I would like to know if it would be possible to filter for independent records on a record table already created. I would just like to import my record table in R and filter for every independent events every 60 minutes for example. I did not find a solution with the pacakge CamTrapR, is there another package that you are aware of that could help me filter for independent events? Or is it actually possible with CamTrapR?

Thank you for your help, 

Best regards,

Emeline Auda

Juergen Niedballa

unread,
Jun 3, 2022, 2:35:41 AM6/3/22
to camtrapR
Hello Emeline, 
it is possible with the (internal) function camtrapR:::assessTemporalIndependence(). Just search it and you will find several threads here on the group. Please refer to the more recent ones. 
Note that it is just a workaround and does not conduct any checks on the input tables, so make sure input is correct and output is what you'd expect.
Best regards,
Jürgen

Emeline Auda

unread,
Jun 3, 2022, 4:43:02 AM6/3/22
to camtrapR
Dear Juergen,

Thank you very much for your answer and sorry that I did not find it in the threads on the group. I have run the code on my data and have a few questions on how it really works. You will find enclosed a very short dataset, only one species for this one and one station but I really wanted to see how it works at that level. My first question is that it does not remove the images that have the same date and time and just keep them. I can easily remove them afterwards by removing duplicates based on deployment, species, date and time but I was just surprised, I assume that the deltamin would be 0 and that it would be removed. You will find enclosed the excel subset and a screeshot of the results. Here my code:

records_filter_30min <- camtrapR:::assessTemporalIndependence(intable = Record_Table_Trial,
                                                              deltaTimeComparedTo = "lastIndepentRecord",
                                                              columnOfInterest = "Species",
                                                              stationCol = "Station",
                                                              minDeltaTime = 30,
                                                              camerasIndependent = FALSE)

Furthermore, I would like to take into account the count of individuals on the images. Instead of taking the first image with 1 individual, I have for example 3 minutes later an image with 4 individuals. This is the one I would like to keep. I saw the parameter countsName that I assume would do that. In my excel table, you will see that I have a column called count with the number of individuals in the image. Can this column be taken into account to filter for independent events and keeping the image with the highest number of individuals?

Best regards,

Emeline
Results_Indep_Records.PNG
Trial_PLWS_Full.xlsx

Juergen Niedballa

unread,
Jun 7, 2022, 2:19:44 AM6/7/22
to camt...@googlegroups.com

Hi Emeline,

duplicates are not removed by assessTemporalIndependence, but by another function (removeDuplicatesOfRecords). This happens automatically when using recordTable, but not when calling assessTemporalIndependence. So in your case it would be easier to remove the duplicates (as you suggested, the duplicated() function helps with that).

Currently, there is no built-in way to keep the record with the highest count. The function always keeps the first record. But you can use the arguments "eventSummaryColumn" and "eventSummaryFunction" to retain and summarize information from the records that are removed, e.g. in your example

eventSummaryColumn = "Count"

eventSummaryFunction = "max"

would give the highest count. See the documentation of ?recordTable for details.

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/af4e2974-7360-4b24-838a-e5c1f2d0944dn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages