clean_mrn: Check and Format MRNs

View source: R/clean_mrn.R

clean_mrnR Documentation

Check and Format MRNs

Description

An MRN follows specific rules

  1. Must be character

  2. Must contain only numeric components

  3. Must be eight characters long and include leading zeros.

This function converts numeric MRNs to character and ensures it follows MRN conventions. Character MRNs can also be passed, and leading zeros will be appended and checked for consistency.

Usage

clean_mrn(x, allow_na = FALSE, check_unique = FALSE)

Arguments

x

vector to be converted and checked to MRN

allow_na

logical indicating whether NA values are accepted. Default is FALSE

check_unique

Check if MRNs are unique

Value

character MRN vector

Examples

1000:1001 %>%
  clean_mrn()

ddsjoberg/bstfun documentation built on Jan. 6, 2023, 5:39 a.m.