knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "README-" )
anonymizer
anonymizes data containing Personally Identifiable Information (PII) using a combination of salting and hashing. You can find quality examples of data anonymization in R here, here, and here.
You can install the latest development version from CRAN:
install.packages("anonymizer") ```` Or from GitHub with: ```R if (packageVersion("devtools") < 1.6) { install.packages("devtools") } devtools::install_github("paulhendricks/anonymizer")
If you encounter a clear bug, please file a minimal reproducible example on GitHub.
anonymizer
employs four convenience functions: salt
, unsalt
, hash
, and anonymize
.
library(dplyr, warn.conflicts = FALSE) library(anonymizer) letters %>% head letters %>% head %>% salt(.seed = 1) letters %>% head %>% salt(.seed = 1) %>% unsalt(.seed = 1) letters %>% head %>% hash(.algo = "crc32") letters %>% head %>% salt(.seed = 1) %>% hash(.algo = "crc32") letters %>% head %>% anonymize(.algo = "crc32", .seed = 1)
library(generator) n <- 6 set.seed(1) ashley_madison <- data.frame(name = r_full_names(n), snn = r_national_identification_numbers(n), dob = r_date_of_births(n), email = r_email_addresses(n), ip = r_ipv4_addresses(n), phone = r_phone_numbers(n), credit_card = r_credit_card_numbers(n), lat = r_latitudes(n), lon = r_longitudes(n), stringsAsFactors = FALSE) knitr::kable(ashley_madison, format = "markdown")
library(detector) ashley_madison %>% detect %>% knitr::kable(format = "markdown")
ashley_madison[] <- lapply(ashley_madison, anonymize, .algo = "crc32") ashley_madison %>% knitr::kable(format = "markdown")
To cite package ‘anonymizer’ in publications use:
Paul Hendricks (2015). anonymizer: Anonymize Data Containing Personally Identifiable Information. R package version 0.2.0. https://github.com/paulhendricks/anonymizer
A BibTeX entry for LaTeX users is
@Manual{, title = {anonymizer: Anonymize Data Containing Personally Identifiable Information}, author = {Paul Hendricks}, year= {2015}, note = {R package version 0.2.0}, url = {https://github.com/paulhendricks/anonymizer}, }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.