dot-collapse_timestamp: .collapse_timestamp helper

.collapse_timestampR Documentation

.collapse_timestamp helper

Description

Util to collapse the TIMESTAMP using lubridate::*_date functions

Usage

.collapse_timestamp(timestamp, ..., period, side = "start")

Value

A vector of the same length as TIMESTAMP, with the collapsed timestamp with the same tz as the original one.

Period

Periods accepted are in the "number period" format, as in floor_date or a custom function name without quotes:

  • hours (exs. "1 hour", "12 hours")

  • days (exs. "1 day", "3 days")

  • weeks (exs. "1 week", "4 weeks")

  • months (exs. "1 month", "6 months")

  • years (exs. "1 year", "7 years")

  • Also a custom function can be supplied, one that transforms the TIMESTAMP variable to the collapsed timestamp desired. See sfn_metrics for details

Side

Side indicates if using floor_date (side = "start) or ceiling_date (side = 'end'). Ceiling dates is not trivial, see ceiling_date for information on how the date will be ceiled.

Examples

arg_tre_timestamp <- get_timestamp(ARG_TRE)
sapfluxnetr:::.collapse_timestamp(
  arg_tre_timestamp, period = "1 day", side = 'start'
)

sapfluxnetr documentation built on Feb. 16, 2023, 7:52 p.m.