It computes summary statistics for a tsibble over calendar periods, usually
used in combination of group_by
.
tsummarise(.data, ...)tsummarise_all(.data, ..., .funs)
tsummarise_if(.data, ..., .predicate, .funs)
tsummarise_at(.data, ..., .vars, .funs)
tsummarize(.data, ...)
tsummarize_all(.data, ..., .funs)
tsummarize_if(.data, ..., .predicate, .funs)
tsummarize_at(.data, ..., .vars, .funs)
A data frame (of tbl_ts
class).
Name-value pairs of expressions. The index variable must be present
in the first name-value pair, with an index function. The remaining components
work like summarise()
. For the scoped variants like _all()
, _at()
, _if()
,
additional arguments for the function call in .funs
will be ignored in ...
.
The index functions that can be used, but not limited:
lubridate::year: yearly aggregation
yearquarter: quarterly aggregation
yearmonth: monthly aggregation
yearweek: weekly aggregation
as.Date or lubridate::as_date: daily aggregation
lubridate::ceiling_date, lubridate::floor_date, or lubridate::round_date: sub-daily aggregation
other index functions from other packages
List of function calls generated by funs()
, or a
character vector of function names, or simply a function.
Bare formulas are passed to rlang::as_function()
to create
purrr-style lambda functions. Note that these lambda prevent
hybrid evaluation from happening and it is thus more efficient to
supply functions like mean()
directly rather than in a
lambda-formula.
A predicate function to be applied to the columns
or a logical vector. The variables for which .predicate
is or
returns TRUE
are selected. This argument is passed to
rlang::as_function()
and thus supports quosure-style lambda
functions and strings representing function names.
A list of columns generated by vars()
,
a character vector of column names, a numeric vector of column
positions, or NULL
.
For a grouped tsibble, the rightmost grouping variable will be dropped after the operation.
The scoped variants only operate on the non-key and non-index variables.