简体   繁体   中英

Display unique characters in dataframe column

I have a data frame of unique object names. I need to create a list of all unique characters used in the column. Is there a way to display a list of all unique characters used in a column?

Example data:

Performance PM
Truck Tips - B - 2001
ASE Parts Specialist (P1)

Output:

a
b
c
d
-
(
1
2
data <- "Example data:
Performance PM
Truck Tips - B - 2001
ASE Parts Specialist (P1)"


sort(unique(strsplit(data,"")[[1]]))
 [1] "-"  " "  "\n" "("  ")"  ":"  "0"  "1"  "2"  "a"  "A"  "B"  "c"  "d"  "e"  "E"  "f"  "i"  "k"  "l"  "m"  "M"  "n"  "o"  "p"  "P" 
[27] "r"  "s"  "S"  "t"  "T"  "u"  "x" 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM