Replace instance values
Source:R/flat_table.R
, R/generic.R
, R/star_database.R
replace_attribute_values.Rd
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
orstar_database
object.- name
A string, dimension name.
- attributes
A vector of strings, attribute names.
- old
A vector of values.
- new
A vector of values.
See also
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')
)