Skip to contents

Formats ID field into a standard format to support reporting.

Usage

format_id(df, id_field)

Arguments

df

data frame; Data frame containing the id_field to be formatted.

id_field

character; The column name of the id field to be formatted.

Value

The input data frame with a new field formatted according the function's format rules.

Details

The input `id_field` is assumed to contain three parts: an alphabetic code, a dash separator, a sequential numeric second part, and an alphabetic third part.

Examples

# Get test data
db_risk <- rarr::db_risk

# Cleanup risk number for sorting
risk <- rarr::format_id(db_risk, "RISK_NO")