View source: R/flat_table_transform.R
| transform_to_values | R Documentation |
Transforms the measure names into values of a new attribute. The values of the measures will become values of the new measure that is indicated.
transform_to_values(ft, attribute, measure, id_reverse, na_rm)
## S3 method for class 'flat_table'
transform_to_values(
ft,
attribute = NULL,
measure = NULL,
id_reverse = NULL,
na_rm = TRUE
)
ft |
A |
attribute |
A string, new attribute that will store the measures names. |
measure |
A string, new measure that will store the measure value. |
id_reverse |
A string, name of a new attribute that will store the row id. |
na_rm |
A boolean, remove rows from output where the value column is NA. |
If we wanted to perform the reverse operation later using the transform_from_values
function, we would need to uniquely identify each original row. By indicating
a value in the id_reverse parameter, an identifier is added that will allow
us to always carry out the inverse operation.
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(),
select_instances_by_comparison(),
select_measures(),
separate_measures(),
transform_attribute_format(),
transform_from_values(),
transform_to_attribute(),
transform_to_measure()
ft <- flat_table('iris', iris) |>
transform_to_values(attribute = 'Characteristic',
measure = 'Value')
ft <- flat_table('iris', iris) |>
transform_to_values(attribute = 'Characteristic',
measure = 'Value',
id_reverse = 'id')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.