vlookup_from_ref: Vlookup replace using a lookup column and reference table

View source: R/utils_vectors.R

vlookup_from_refR Documentation

Vlookup replace using a lookup column and reference table

Description

Vlookup replace using a lookup column and reference table

Usage

vlookup_from_ref(base, lookup_col, lookup_ref, value_col)

Arguments

base

vector of starting values. Replacements will be made in this vector before it is returned.

lookup_col

vector of values with same length as base that will be matched to lookup_ref to deteremine the replacement indices

lookup_ref

vector of reference values, which lookup_col will be matched to in order to determine replacement values.

value_col

vector of replacement values with same length as lookup_ref

Value

vector

See Also

Other vectors: len_unique(), names_values_switch(), rle_df(), rle_groups(), rle_seq(), sort_by_names(), true_names(), unify_vec_preserve_order(), unique_with_names(), vlookup(), zchar_remove()

Examples

ref <- tibble::tibble(lookup = letters[1:5], value = 1:5)
original <- tibble::tibble(lookup = letters[1:20], base = runif(20, min = 6, max = 20))
dplyr::mutate(original, base = vlookup_from_ref(base, lookup, ref$lookup, ref$value))

yogat3ch/UU documentation built on May 31, 2024, 10:14 p.m.