I propose a new function, split_time(), that automates the process of splitting deployments into segments of a regular, specified duration.
Proposed Usage:
split_time(
x,
deployment_id = NULL,
duration,
~anchor_date = "deployment"~
)
Arguments:
- x: A camtrapdp data package object.
- duration: A
character string defining the length of each segment. This should support intervals like "1 day", "1 week", or "1 month".
- deployment_id: An optional
character vector of deploymentIDs to split. If NULL (the default), all deployments will be considered.
- anchor_date: A parameter to control how the start of the intervals is determined. This is critical for aligning the splits correctly. It would have two modes:
"deployment" (Default): The regular intervals are calculated relative to the start time of each deployment.
- A
POSIXct date (e.g., as.POSIXct("2025-01-01")): The intervals are calculated based on an absolute calendar grid that starts from the given anchor_date. This allows for splitting deployments along true calendar boundaries (e.g., at the start of every calendar month or week).
Expected Behavior:
The function would identify deployments longer than the specified duration, calculate the appropriate split points based on the duration and anchor_date, and then segment the original deployment. This involves creating new unique deploymentIDs, truncating the original deployment, and re-assigning all associated observations and media to the correct new deployment segment based on their timestamp.
I propose a new function,
split_time(), that automates the process of splitting deployments into segments of a regular, specified duration.Proposed Usage:
Arguments:
characterstring defining the length of each segment. This should support intervals like "1 day", "1 week", or "1 month".charactervector ofdeploymentIDs to split. IfNULL(the default), all deployments will be considered."deployment"(Default): The regular intervals are calculated relative to the start time of each deployment.POSIXctdate (e.g.,as.POSIXct("2025-01-01")): The intervals are calculated based on an absolute calendar grid that starts from the given anchor_date. This allows for splitting deployments along true calendar boundaries (e.g., at the start of every calendar month or week).Expected Behavior:
The function would identify deployments longer than the specified duration, calculate the appropriate split points based on the duration and anchor_date, and then segment the original deployment. This involves creating new unique
deploymentIDs, truncating the original deployment, and re-assigning all associatedobservationsandmediato the correct newdeploymentsegment based on theirtimestamp.