maskData: maskData obfuscates a column vector

Description Usage Arguments Value Examples

View source: R/maskData.R

Description

maskData maps the current values in a column (such as names) and maps them to either 1 or 2 levels. This is useful for quickly changing surgeon names in a report so that the surgeon identity is protected. The orignal values are set to the names of the newly created character vector. This function can map up to 26^2 (676) values.

Usage

1
maskData(x, header = "", randomize = TRUE)

Arguments

x

column vector of data to mask

header

character string to preappend to each value

randomize

should the mask be applied randomly?

Value

a named character vector

Examples

1
2
3
4
5
6
test_df <- data.frame(original = sample(paste0("SURG",1:total_surgeons),30,
replace = TRUE),
stringsAsFactors = FALSE)

test_df <- dplyr::mutate(test_df, new = maskData(original))
test_df

West-End-Statistics/r-library-vakdr documentation built on Dec. 18, 2021, 7:16 p.m.