clean_ids: Clean IDs

Description Usage Arguments Value Examples

View source: R/clean_ids.R

Description

Use this function to remove SIDs or Emplids that may have extra spaces or hyphens in them.

Usage

1
clean_ids(data, check_errors = FALSE)

Arguments

data

Any dataframe or list object contains sids

check_errors

Returns a column indicating whether there are errors for a given sid or emplid. Errors are deemed as not having the right character length (9) or containing lettters in them.

Value

Returns a dataframe or list with clean sids.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
library(magrittr)
library(dplyr)

messy_sids <- tibble(
  SID = c("123456789", "123-456-789", " 1234-56789", "12345"),
  Emplid = c("777777777", "8888-8989", " d34df8878", "77777"),
  name = c("Batman", "Supergirl", "Flash", "Aquaman")
)

clean_ids(messy_sids)

messy_sids %>%
  clean_ids(check_errors = TRUE)

Edgar-Zamora/bbccIR documentation built on Feb. 3, 2022, 11:06 a.m.