- By Edmond Lau
- Highly Recommended 👍
- http://www.theeffectiveengineer.com/
- They are the people who get things done. Effective Engineers produce results.
library(tidyverse) | |
tryThis <- data.frame(x = c("A, B ", | |
"A", | |
"B", | |
"C, A, B", | |
"C, B", | |
"C", | |
"A, B")) | |
remove_spaces <- function(x){ gsub(x, pattern = " ", replacement = "")} |
# 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]) | |
} |