Learn R Programming

MazamaTimeSeries (version 0.3.0)

sts_trimDate: Trim sts time series object to full days

Description

Trims the date range of a sts object to local time date boundaries which are within the range of data. This has the effect of removing partial-day data records at the start and end of the timeseries and is useful when calculating full-day statistics.

Day boundaries are calculated using the specified timezone or, if NULL, from sts$meta$timezone.

Usage

sts_trimDate(sts = NULL, timezone = NULL)

Value

A subset of the incoming sts time series object. (A list with meta and data dataframes.)

Arguments

sts

SingleTimeSeries sts object.

timezone

Olson timezone used to interpret dates.

Examples

Run this code
library(MazamaTimeSeries)

UTC_week <- sts_filterDate(
  example_sts,
  startdate = 20180808,
  enddate = 20180815,
  timezone = "UTC"
)

# UTC day boundaries
head(UTC_week$data)

# Trim to local time day boundaries
local_week <- sts_trimDate(UTC_week)
head(local_week$data)

Run the code above in your browser using DataLab