replace_attribute_values.flat_table {rolap}R Documentation

Replace instance values

Description

Given the values of a possible instance, for that combination, replace them with the new data values.

Usage

## S3 method for class 'flat_table'
replace_attribute_values(db, name = NULL, attributes = NULL, old, new)

replace_attribute_values(db, name, attributes, old, new)

## S3 method for class 'star_database'
replace_attribute_values(db, name, attributes = NULL, old, new)

Arguments

db

A flat_table or star_database object.

name

A string, dimension name.

attributes

A vector of strings, attribute names.

old

A vector of values.

new

A vector of values.

Value

A flat_table or star_database object.

See Also

star_database, flat_table

Other star database and flat table functions: get_attribute_names.flat_table(), get_measure_names.flat_table(), get_similar_attribute_values.flat_table(), get_similar_attribute_values_individually.flat_table(), get_unique_attribute_values.flat_table(), set_attribute_names.flat_table(), set_measure_names.flat_table(), snake_case.flat_table()

Examples


db <- star_database(mrs_cause_schema, ft_num) |>
  replace_attribute_values(name = "where",
    old = c('1', 'CT', 'Bridgeport'),
    new = c('1', 'CT', 'Hartford'))

db <- star_database(mrs_cause_schema, ft_num) |>
  replace_attribute_values(name = "where",
                           attributes = c('REGION', 'State'),
                           old = c('1', 'CT'),
                           new = c('2', 'CT'))

ft <- flat_table('iris', iris) |>
  replace_attribute_values(
    attributes = 'Species',
    old = c('setosa'),
    new = c('versicolor')
  )


[Package rolap version 2.5.1 Index]