Build a canonical, human-readable per-record identifier string
build_id_string.RdProduces one string per row that encodes the organization, tax year, name, and
standardized title. The string is meant to be human-legible for debugging and
to be fed to create_emp_ids() for hashing. Where two rows produce an identical
string (a genuine duplicate record within an organization-year) a -D{k}
occurrence suffix is appended so the returned vector is always unique.
Usage
build_id_string(
df,
org_id = "ein",
year = "taxyr",
name = "name",
title = "title.standard"
)Details
This replaces the draft create_hash_string(), which interpolated the literal
strings "EIN2" and OID instead of the corresponding columns and whose
argument names did not match the call site.
Examples
df <- data.frame(
ein = c("11", "11"), taxyr = c(2019, 2020),
name = c("Jane Roe", "Jane Roe"), title.standard = c("CEO", "CEO")
)
build_id_string(df)
#> [1] "EIN-11-Y-2019-NAME-JANE-ROE-TITLE-CEO"
#> [2] "EIN-11-Y-2020-NAME-JANE-ROE-TITLE-CEO"