update_selection_general {starschemar} | R Documentation |
Update dimension records with a set of values in given columns
Description
For a dimension, given a vector of column names, a vector of old values for those columns, another vector column names, and a vector of new values for those columns, it adds an update to the set of updates that modifies all the records that have the combination of old values in the first column vector with the new values in the second column vector.
Usage
update_selection_general(
updates = NULL,
dimension,
columns_old = vector(),
old_values = vector(),
columns_new = vector(),
new_values = vector()
)
## S3 method for class 'record_update_set'
update_selection_general(
updates = NULL,
dimension,
columns_old = vector(),
old_values = vector(),
columns_new = vector(),
new_values = vector()
)
Arguments
updates |
A |
dimension |
A |
columns_old |
A vector of column names. |
old_values |
A vector of character values. |
columns_new |
A vector of column names. |
new_values |
A vector of character values. |
Value
A record_update_set
object.
See Also
Other data cleaning functions:
get_conformed_dimension()
,
get_conformed_dimension_names()
,
get_dimension()
,
get_dimension_names()
,
match_records()
,
modify_conformed_dimension_records()
,
modify_dimension_records()
,
record_update_set()
,
update_record()
,
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() |>
update_selection_general(
dimension = where,
columns_old = c("state", "city"),
old_values = c("CT", "Bridgepor"),
columns_new = c("city"),
new_values = c("Bridgeport")
)