pivotr: Create a pivot table

Description Usage Arguments Details Examples

View source: R/pivotr.R

Description

Create a pivot table

Usage

1
2
3
pivotr(dataset, cvars = "", nvar = "None", fun = "mean",
  normalize = "None", tabfilt = "", tabsort = "", nr = NULL,
  data_filter = "")

Arguments

dataset

Dataset to tabulate

cvars

Categorical variables

nvar

Numerical variable

fun

Function to apply to numerical variable

normalize

Normalize the table by row total, column totals, or overall total

tabfilt

Expression used to filter the table (e.g., "Total > 10000")

tabsort

Expression used to sort the table (e.g., "desc(Total)")

nr

Number of rows to display

data_filter

Expression used to filter the dataset before creating the table (e.g., "price > 10000")

Details

Create a pivot-table. See https://radiant-rstats.github.io/docs/data/pivotr.html for an example in Radiant

Examples

1
2
3
4
5
6
pivotr(diamonds, cvars = "cut") %>% str()
pivotr(diamonds, cvars = "cut")$tab
pivotr(diamonds, cvars = c("cut","clarity","color"))$tab
pivotr(diamonds, cvars = "cut:clarity", nvar = "price")$tab
pivotr(diamonds, cvars = "cut", nvar = "price")$tab
pivotr(diamonds, cvars = "cut", normalize = "total")$tab

radiant-rstats/radiant.data documentation built on Nov. 13, 2018, 6:57 a.m.