Skip to contents

Transforms numeric attributes adapting their format as indicated.

Usage

transform_attribute_format(
  ft,
  attributes,
  width,
  decimal_places,
  k_sep,
  decimal_sep,
  space_filling
)

# S3 method for flat_table
transform_attribute_format(
  ft,
  attributes,
  width = 1,
  decimal_places = 0,
  k_sep = NULL,
  decimal_sep = NULL,
  space_filling = TRUE
)

Arguments

ft

A flat_table object.

attributes

A vector of strings, attribute names.

width

An integer, string length.

decimal_places

An integer, number of decimal places.

k_sep

A character, thousands separator used (It can not be changed).

decimal_sep

A character, decimal separator used (It can not be changed).

space_filling

A boolean, fill on the left with spaces (with '0' otherwise).

Value

ft A flat_table object.

Details

If a number > 1 is specified in the width parameter, at least that length will be obtained in the result, padded with blanks on the left.

Examples


ft <- flat_table('iris', iris) |>
  transform_to_attribute(measures = "Sepal.Length", decimal_places = 2) |>
  transform_attribute_format(
    attributes = "Sepal.Length",
    width = 5,
    decimal_places = 1
  )