starschemar (version 1.2.0)

update_selection: Update dimension records with a set of values

Description

For a dimension, given a vector of column names, a vector of old values and a vector of new values, it adds an update to the set of updates that modifies all the records that have the combination of old values in the columns with the new values in those same columns.

Usage

update_selection(
  updates = NULL,
  dimension,
  columns = vector(),
  old_values = vector(),
  new_values = vector()
)

# S3 method for record_update_set update_selection( updates = NULL, dimension, columns = vector(), old_values = vector(), new_values = vector() )

Arguments

updates

A record_update_set object.

dimension

A dimension_table object, dimension to update.

columns

A vector of column names.

old_values

A vector of character values.

new_values

A vector of character values.

Value

A record_update_set object.

See Also

Other data cleaning functions: get_conformed_dimension_names(), get_conformed_dimension(), get_dimension_names(), get_dimension(), match_records(), modify_conformed_dimension_records(), modify_dimension_records(), record_update_set(), update_record(), update_selection_general()

Examples

Run this code
# NOT RUN {
library(tidyr)

dim_names <- st_mrs_age %>%
    get_dimension_names()

where <- st_mrs_age %>%
  get_dimension("where")

# head(where, 2)

updates <- record_update_set() %>%
  update_selection(
    dimension = where,
    columns = c("city"),
    old_values = c("Bridgepor"),
    new_values = c("Bridgeport")
  )

# }

Run the code above in your browser using DataCamp Workspace