View source: R/flat_table_transform.R
transform_to_attribute | R Documentation |
Transform measures into attributes. We can indicate if we want all the numbers in the result to have the same length and the number of decimal places.
transform_to_attribute(ft, measures, width, decimal_places, k_sep, decimal_sep)
## S3 method for class 'flat_table'
transform_to_attribute(
ft,
measures,
width = 1,
decimal_places = 0,
k_sep = ",",
decimal_sep = "."
)
ft |
A |
measures |
A vector of strings, measure names. |
width |
An integer, string length. |
decimal_places |
An integer, number of decimal places. |
k_sep |
A character, indicates thousands separator. |
decimal_sep |
A character, indicates decimal separator. |
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.
ft A flat_table
object.
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_attribute_format()
,
transform_from_values()
,
transform_to_measure()
,
transform_to_values()
ft <- flat_table('iris', iris) |>
transform_to_attribute(
measures = "Sepal.Length",
width = 3,
decimal_places = 2
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.