Learn R Programming

flattabler (version 1.0.0)

remove_k: Remove thousands separator

Description

A pivot table should only contain label rows and columns, and an array of values, usually numeric data. Values, even though they are numbers, are represented as text and sometimes include a thousands separator that can be removed using this function.

Usage

remove_k(pt, sep = ".")

# S3 method for pivot_table remove_k(pt, sep = ".")

Arguments

pt

A pivot_table object.

sep

A character, thousands separator to remove.

Value

A pivot_table object.

Details

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_k()

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

# }

Run the code above in your browser using DataLab