shift_time | R Documentation |
Shifts date-times for selected deployments (and associated media and observations) by a specified duration. This function can be used to correct date-time issues such as incorrectly set time zones.
Deployments: deploymentStart
and deploymentEnd
are updated and
timestampIssues
is set to FALSE
.
Media: timestamp
is updated.
Observations: eventStart
and eventEnd
are updated.
Metadata (x$temporal
) are updated to match the new temporal scope.
shift_time(x, deployment_id, duration)
x |
Camera Trap Data Package object, as returned by |
deployment_id |
One or more deploymentIDs. |
duration |
Difference between the current and new date-times.
Provide as a |
x
with shifted date-times.
Other transformation functions:
merge_camtrapdp()
,
round_coordinates()
,
write_dwc()
,
write_eml()
# Set desired duration between current and new date-times (e.g. 4 hours earlier)
library(lubridate, warn.conflicts = FALSE)
duration(-4, units = "hours")
# Or calculate one based on two date-times
current <- ymd_hms("2024-04-01T04:00:00", tz = "UTC")
new <- ymd_hms("2024-04-01T00:00:00", tz = "UTC")
duration <- as.duration(interval(current, new))
# Shift date-times for 2 deployments
x <- example_dataset()
x_shifted <- shift_time(x, c("00a2c20d", "29b7d356"), duration)
# Inspect results
deployments(x)[, c("deploymentID", "deploymentStart", "deploymentEnd")]
deployments(x_shifted)[, c("deploymentID", "deploymentStart", "deploymentEnd")]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.