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)?
If you want to make it slightly less cumbersome to type:
uniqchars <- function(x) unique(strsplit(x, "")[[1]])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With