anonymize: Anonymize

Description Usage Arguments Value Examples

View source: R/anonymize.R

Description

Mask data using hasing function

Usage

1
anonymize(x, algo)

Arguments

x

vector to anonymize

algo

character scalar to be used for digest function in digest package, read ?digest::digest.

Value

character vector of hashes, same length as length of x argument.

Examples

1
2
3
4
5
6
7
8
suppressPackageStartupMessages(library(dwtools))

X = dw.populate(N=1e5, scenario="star")
DT <- joinbyv(X$SALES, list(X$CUSTOMER))
print(DT)
cols_to_mask <- c("cust_code", "cust_name", "cust_mail")
DT[, (cols_to_mask) := lapply(.SD, anonymize, "crc32"), .SDcols=c(cols_to_mask)]
print(DT)

jangorecki/dwtools documentation built on May 18, 2019, 12:24 p.m.