dts_lag: Lag (or lead) columns in a Date Time Series data frame

View source: R/lag.R

dts_lagR Documentation

Lag (or lead) columns in a Date Time Series data frame

Description

Lag (or lead) columns in a Date Time Series data frame

Usage

dts_lag(
  x,
  dtt = "DateTime",
  colname = dts_colnames(x),
  n = 1L,
  units = dtt_units(x[[dtt]])
)

dts_lead(
  x,
  dtt = "DateTime",
  colname = dts_colnames(x),
  n = 1L,
  units = dtt_units(x[[dtt]])
)

dts_delay(
  x,
  dtt = "DateTime",
  colname = dts_colnames(x),
  n = 1L,
  units = dtt_units(x[[dtt]])
)

Arguments

x

A date/time vector.

dtt

A string specifying the column with the Date or POSIXct values.

colname

A character vector specifying the column(s) with the other values.

n

A int (integer scalar) of the lag.

units

A string of the lag time units.

Examples

dts_lag(dts_data[1:4,], n = 2)

poissonconsulting/dts documentation built on March 10, 2024, 6:21 a.m.