Skip to content

Instantly share code, notes, and snippets.

@achekroud
Created January 18, 2018 16:47
Show Gist options
  • Save achekroud/62ca298f4418de9b78ccc2add683774e to your computer and use it in GitHub Desktop.
Save achekroud/62ca298f4418de9b78ccc2add683774e to your computer and use it in GitHub Desktop.
anonymize.R
# Function for hashing a column
anonymize <- function(x, algo="sha256"){
unq_hashes <- vapply(unique(x),
function(object) digest::digest(object, algo=algo), FUN.VALUE="", USE.NAMES=TRUE)
unname(unq_hashes[x])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment