Learn R Programming

flattabler (version 1.0.0)

remove_agg: Remove rows and columns with aggregated data

Description

Removes pivot table rows and columns that contain aggregated data.

Usage

remove_agg(pt, indicator)

# S3 method for pivot_table remove_agg(pt, indicator = "")

Arguments

pt

A pivot_table object.

indicator

A string, row or column label for aggregates.

Value

A pivot_table object.

Details

A pivot table should only contain label rows and columns, and an array of values, usually numeric data.

Aggregated data is recognized because the label of the row or column closest to the array of values is empty or has a special value as an indicator.

To correctly carry out this operation, the number of rows and columns that contain labels must be defined, and the table must only contain the pivot table rows and columns.

Examples

Run this code
# NOT RUN {
library(tidyr)

pt <-
  pt_m4 %>%
  remove_top(1) %>%
  define_labels(n_col = 2, n_row = 2) %>%
  remove_agg()

pt <-
  pt_pivottabler %>%
  define_labels(n_col = 2, n_row = 2) %>%
  remove_agg("Total") %>%
  remove_agg()

# }

Run the code above in your browser using DataLab