pivotr {radiant.data} | R Documentation |
Create a pivot table
Description
Create a pivot table
Usage
pivotr(
dataset,
cvars = "",
nvar = "None",
fun = "mean",
normalize = "None",
tabfilt = "",
tabsort = "",
tabslice = "",
nr = Inf,
data_filter = "",
arr = "",
rows = NULL,
envir = parent.frame()
)
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)") |
tabslice |
Expression used to filter table (e.g., "1:5") |
nr |
Number of rows to display |
data_filter |
Expression used to filter the dataset before creating the table (e.g., "price > 10000") |
arr |
Expression to arrange (sort) the data on (e.g., "color, desc(price)") |
rows |
Rows to select from the specified dataset |
envir |
Environment to extract data from |
Details
Create a pivot-table. See https://radiant-rstats.github.io/docs/data/pivotr.html for an example in Radiant
Examples
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
[Package radiant.data version 1.6.6 Index]