Using timeShiftImages function with data stored in csv format

74 views
Skip to first unread message

Sarah Bassing

unread,
Sep 1, 2020, 9:05:14 PM9/1/20
to camtrapR
Hello,

I am trying to use the timeShiftImages function to shift the date and time for camera trap data. I already processed the images in Timelapse and exported the resulting data (date & time included) as a csv file. Is it possible to use the timeShiftImages function to adjust the date and times using just the csv file instead of adjusting them in the raw image data? If not, do you have any suggestions for how to go about doing this?

Best,
Sarah B.

Juergen Niedballa

unread,
Sep 7, 2020, 4:18:44 AM9/7/20
to camtrapR
Hi Sarah, 
so do I understand correctly that you wish to change the time stamp in the table only, without changing the images? 
If the date/time column is in POSIXct format, you can easily add or subtract values (unit = 1 second).

For example, the following is the time 1 hour ago:
Sys.time() - 3600   # 
now() - 3600   # now() is from lubridate

You should be able to adjust the times of the images at a particular station by subsetting / indexing only the relevant stations.

One word of caution, if you use a time zone with daylight saving time, you may accidentally obtain invalid date/time, causing an error with this method. So better to use UTC a time zone without DST.

Best regards,
Jürgen

Sarah Bassing

unread,
Sep 8, 2020, 10:30:27 AM9/8/20
to camtrapR
Hi Jürgen,

Yes! This is exactly what I was looking for. Thank you!

Cheers,
Sarah B. 

Juergen Niedballa

unread,
Sep 8, 2020, 10:50:15 AM9/8/20
to camtrapR
Great. The lubridate package has some nice convenience functions that may make this a little easier. See the "Arithmetic with date-times" section in the lubridate paper, or the section of the same name in the lubridate vignette. 
Cheers,
Jürgen

Reply all
Reply to author
Forward
0 new messages