pivot_count: Title

View source: R/pivot_count.R

pivot_countR Documentation

Title

Description

Title

Usage

pivot_count(data, cols = NULL, rows = NULL, pivot = TRUE, wt = NULL)

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.

cols

a character vector of items

rows

a character vector of items

pivot

logical: should wide table be returned - col categories as columns (TRUE), or left long and tidy (FALSE)?

Examples

tidy_titanic %>% pivot_count(rows = sex)
tidy_titanic %>% pivot_count(cols = sex)
tidy_titanic %>% pivot_count(rows = survived, cols = sex)
tidy_titanic %>% pivot_count(rows = c(survived, sex), cols = age)
tidy_titanic %>% pivot_count(rows = c(survived), cols = c(age, sex))
tidy_titanic %>% pivot_count(cols = c(survived), rows = c(age, sex, class))
tidy_titanic %>% pivot_count(rows = c(survived, sex), cols = age, pivot = FALSE)
flat_titanic %>% pivot_count(rows = sex, wt = freq)

EvaMaeRey/tidypivot documentation built on Feb. 27, 2025, 4:04 a.m.