Learn R Programming

tsibble (version 0.1.0)

group_by.tbl_ts: Group by one or more variables

Description

Group by one or more variables

Usage

# S3 method for tbl_ts
group_by(.data, ..., add = FALSE)

# S3 method for grouped_ts ungroup(x, ...)

Arguments

.data

A tsibble.

...

Variables to group by. It follows a consistent rule as the "key" expression in as_tsibble, which means | for nested variables and , for crossed variables. The following operations will affect the tsibble structure based on the way how the variables are grouped.

add

TRUE adds to the existing groups, otherwise overwrites.

x

A (grouped) tsibble.

See Also

dplyr::group_by

dplyr::ungroup

Examples

Run this code
# NOT RUN {
data(tourism)
tourism %>%
  group_by(Region | State) %>%
  summarise(geo_trips = sum(Trips))
# }

Run the code above in your browser using DataLab