Learn R Programming

flattabler (version 1.0.0)

flatten_table_list: Transform a pivot table list into a flat table

Description

Given a list of pivot tables and a transformation function that flattens a pivot_table object, transforms each table using the function and merges the results into a flat table.

Usage

flatten_table_list(lpt = list(), FUN)

Arguments

lpt

A list of pivot_table objects.

FUN

A function, transformation function that flattens a pivot_table object (it returns a tibble).

Value

A tibble, a flat table implemented by a tibble.

Examples

Run this code
# NOT RUN {
library(tidyr)

f <- function(pt) {
  pt %>%
    set_page(1, 1) %>%
    remove_top(1) %>%
    define_labels(n_col = 2, n_row = 2) %>%
    remove_k() %>%
    replace_dec() %>%
    fill_values() %>%
    fill_labels() %>%
    remove_agg() %>%
    unpivot()
}

ft <- flatten_table_list(list_pt, f)

# }

Run the code above in your browser using DataLab