An S3 reference_index is a list retaining reference values, their rows and reusable matching indexes.
Construction
Use reference_index() to index a reference table, character vector or list of text values.
prepare_model_references() and prepare_mapping_references() also create these objects internally.
Catalogue aliases attached to the selected lookup column are incorporated automatically.
Structure
data: the input data retained for this index, in row order.column: the lookup column for a data frame, orNULLfor a vector or list.values: the reference values used for matching.matchingandignore_case: the selected comparison policy.aliases: a named character vector from accepted aliases to canonical values.exact,normalizedandalias_rows: internal lookup structures containing row positions.
Preparation may add a lookup specification.
Model-based preparation also adds version, containing the reference table's SHA-256 checksum.
Use
Pass the object to reference_match_rows() to obtain matching row indexes for each supplied value.
Those indexes address this object's data; they are not necessarily row numbers in the original CSV.
Exact matches take precedence over aliases, followed by configured normalized-name matching.
Duplicate matches remain separate candidates. Rebuild the index after changing its data or lookup policy.
There are no class-specific S3 methods; use the lookup function rather than editing the internal indexes.