Skip to contents

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

Usage

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

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

# S3 method for 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.

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