Open MatthieuStigler opened 5 years ago
Problem is if item is repeated multiple times! AAA BBB AAA want A B A
code below should do it:
here_remv_repeat <- function(x) { if(!is.factor(x)) x <- as.factor(x) x_char <- as.character(x) x_num <- as.numeric(x) x_rep <- c(1, diff(x_num)) x_char[x_rep==0] <- "" x_char }
Problem is if item is repeated multiple times! AAA BBB AAA want A B A
code below should do it: