I am trying to split a string and then check if all its elements are unique. So far I have done the following:
df <- data.frame(
"id" = c("001;002;003", "001;001;001", "001;001;002"),
"v1" = c("a", "b", "c")
)
sapply(strsplit(df$id, ";"), function(x) unique(x) %in% df$id)
My intention is to have an output of FALSE, TRUE, and FALSE, respectively for "001;002;003", "001;001;001", and "001;001;002"
Thanks in advance!!