replace_dec: Replace decimal separator

View source: R/pivot_table.R

replace_decR Documentation

Replace decimal 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 decimal separator different from the one needed; it can be replaced using this function.

Usage

replace_dec(pt, sep)

## S3 method for class 'pivot_table'
replace_dec(pt, sep = ".")

Arguments

pt

A pivot_table object.

sep

A character, new decimal separator to use.

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.

The only decimal separators considered are "." and ",".

Value

A pivot_table object.

See Also

pivot_table

Other pivot table transformation functions: extract_labels(), fill_labels(), fill_values(), remove_agg(), remove_bottom(), remove_cols(), remove_empty(), remove_k(), remove_left(), remove_right(), remove_rows(), remove_top(), unpivot()

Examples


pt <-
  pt_ex |>
  remove_top(1) |>
  define_labels(n_col = 2, n_row = 2) |>
  replace_dec()


flattabler documentation built on Sept. 15, 2023, 1:06 a.m.