knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
library(chilir)
library(tidyverse)

chilir

Functions for CHI numbers

Installation

You can install the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("graemegowans/chilir")

pad_chi()

Use pad_chi() to add a leading zero to a 9 character string. Other strings are left alone.

df <- tibble(chi_no = c("123456789", "1234567890", "123"))
df %>% mutate(padded_chi = pad_chi(chi_no))

chi_check()

Use chi_check() to check for valid CHI.

df <- tibble(chi_no = c("0101209991", "3201209991", "0113209991", "3213209991",
                        "123", "12345678901", "?123456789", "A123456789", "0101209992"))
df %>% mutate(checked = chi_check(chi_no))


graemegowans/chilir documentation built on March 30, 2020, 10:14 p.m.