Columns of numeric data in sts$data are grouped by unit and then summarized using FUN.

Columns with non-numeric data are summarized by just picking the first occurrence in each unit. This preserves the utility of columns containing repeated metadata.

The most typical use case is creating daily averages where each day begins at midnight. Day boundaries are calculated using the specified timezone or, if NULL, the time zone found in sts$meta$timezone[1]. Leaving timezone = NULL, the default, results in "local time" date filtering which is the most common use case.

sts_summarize(
  sts,
  timezone = NULL,
  unit = c("day", "week", "month", "year"),
  FUN = NULL,
  ...,
  minCount = NULL
)

Arguments

sts

sts object.

timezone

Olson timezone used to interpret dates.

unit

Unit used to summarize by (e.g. "day").

FUN

Function used to summarize time series.

...

Additional arguments to be passed to FUN (_e.g._ na.rm = TRUE).

minCount

Minimum number of valid data records required to calculate summaries. Time periods with fewer valid records will be assigned NA.

Value

An sts time series object containing daily (or other) statistical summaries. (A list with meta and data dataframes.)