add_auto_columns: Add columns with auto-generated ids

View source: R/auto_ids.R

add_auto_columnsR Documentation

Add columns with auto-generated ids

Description

Add columns to a table using a hash of other columns, as defined in a data model

Usage

add_auto_columns(table, table_name, model, nchar = 8, error_on_missing = TRUE)

hash_id(x, nchar = 8)

Arguments

table

Data table to import (tibble or data.frame)

table_name

Name of data table in model

model

dm object describing data model

nchar

number of characters in the resulting strings (max 32)

error_on_missing

Logical for whether to throw an error if any columns necessary to create another column are missing. If FALSE, the function will issue a warning but proceed without adding the column.

x

string use to create hash

Details

Automatically generated hashed identifiers based on the values of other columns in table. model should have an attribute auto_id containing a vector of columns to be used.

Value

table with additional columns

identifier based on a hash of x


UW-GAC/AnvilDataModels documentation built on Nov. 3, 2024, 7:33 p.m.