transform_attribute_format {rolap}R Documentation

Transform attribute format

Description

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 class '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).

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.

Value

ft A flat_table object.

See Also

flat_table

Other flat table transformation functions: add_custom_column(), remove_instances_without_measures(), replace_empty_values(), replace_string(), replace_unknown_values(), select_attributes(), select_instances_by_comparison(), select_instances(), select_measures(), separate_measures(), transform_from_values(), transform_to_attribute(), transform_to_measure(), transform_to_values()

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
  )


[Package rolap version 2.5.1 Index]