Let's say that I have a string "rrkn". Is there a function in R that'll return a vector "r", "k", "n" (i.e. each unique character in the string)?
"rrkn"
"r"
"k"
"n"
If you want to make it slightly less cumbersome to type:
uniqchars <- function(x) unique(strsplit(x, "")[[1]])
2.1m questions
2.1m answers
60 comments
57.0k users