Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save gabrielburcea/76d1c51674d2e7cec1c42c4fd2c33b79 to your computer and use it in GitHub Desktop.
Save gabrielburcea/76d1c51674d2e7cec1c42c4fd2c33b79 to your computer and use it in GitHub Desktop.
Anonymizing_fct
hashed_id <- function(x, salt){
y <- paste(x, salt)
y <- sapply(y, function(X) digest(X, algo = "sha1"))
as.character(y)
}
data$PseudoID <- hashed_id(data$PseudoID, "somesalt1234")
data$Postcode.Sector <- hashed_id(data$Postcode.Sector, "somesalt1234")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment