match_records: Make a dimension record equal to another

View source: R/record_update_set_match_records.R

match_recordsR Documentation

Make a dimension record equal to another

Description

For a dimension, given the primary key of two records, it adds an update to the set of updates that modifies the combination of values of the rest of attributes of the first record so that they become the same as those of the second.

Usage

match_records(updates, dimension, old, new)

## S3 method for class 'record_update_set'
match_records(updates, dimension, old, new)

Arguments

updates

A record_update_set object.

dimension

A dimension_table object, dimension to update.

old

A number, primary key of the record to update.

new

A number, primary key of the record from which the values are taken.

Details

Primary keys are only used to get the combination of values easily. The update is defined exclusively from the rest of values.

It is especially useful when it is detected that two records should be only one: Two have been generated due to some data error.

Value

A record_update_set object.

See Also

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

Examples


dim_names <- st_mrs_age |>
    get_dimension_names()

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

# head(where, 2)

updates <- record_update_set() |>
  match_records(dimension = where,
                old = 1,
                new = 2)


josesamos/starschemar documentation built on Jan. 26, 2024, 2:03 p.m.