Skip to content

split_time() #192

Description

@martijn-bollen

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:
  1. "deployment" (Default): The regular intervals are calculated relative to the start time of each deployment.
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions