retbl: Re-tibble by group

Description Usage Arguments Examples

View source: R/retbl.R

Description

Use the superpowered dplyr::summarise() with explicit grouping.

Usage

1
2
3
4
5
6
7
retbl(.data, ...)

retbl_drop(.data, ...)

retbl_peel(.data, ...)

retbl_rowwise(.data, ...)

Arguments

.data

A data frame, data frame extension (e.g. a tibble), or a lazy data frame (e.g. from dbplyr or dtplyr). See Methods, below, for more details.

...

<data-masking> Name-value pairs of summary functions. The name will be the name of the variable in the result.

The value can be:

  • A vector of length 1, e.g. min(x), n(), or sum(is.na(y)).

  • A vector of length n, e.g. quantile().

  • A data frame, to add multiple columns from a single expression.

Examples

1
2
3
4
5
6
library(dplyr, warn.conflicts = FALSE)

# default keeps grouping after sumr
starwars %>%
  group_by(species) %>%
  retbl(film = unique(unlist(films)))

paleolimbot/sumr documentation built on Dec. 31, 2020, 1:13 a.m.