Learn R Programming

flattabler (version 1.2.0)

fill_labels: Fill in missing labels

Description

Fills missing values in row and column labels for a pivot table. In columns they are filled down; in rows to the right.

Usage

fill_labels(pt)

# S3 method for pivot_table fill_labels(pt)

Value

A pivot_table object.

Arguments

pt

A pivot_table object.

Details

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

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.

See Also

Other pivot table transformation functions: extract_labels(), fill_values(), get_col_values(), remove_agg(), remove_k(), replace_dec()

Examples

Run this code
library(tidyr)

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

pt <-
  pt_ine2871 %>%
  remove_top(6) %>%
  remove_bottom(9) %>%
  define_labels(n_col = 1, n_row = 2) %>%
  fill_labels()

Run the code above in your browser using DataLab