I have done like this to get the result I need more directly
A<-c("Tell me how many different letter this vector has?")
prop.table(table(strsplit(A,"")))
? a c d e f h i l m n o r s
t
0.16 0.02 0.04 0.02 0.02 0.14 0.04 0.06 0.04 0.06 0.04 0.04 0.04 0.06 0.04
0.10
T v w y
0.02 0.02 0.02 0.02
two questios:
1) is there a direct way of making capital "T" the same as lower case "t"?
2) And can I avoid on the strslipt function to exclude the "?" and the
spaces between words?
I know I can do:
x<-table(strsplit(A, ""))
]
x
a c d e f h i l m n o r s t T v w y
2 1 1 7 2 3 2 3 2 2 2 3 2 5 1 1 1 1
My question is always to find out if there's a more direct way of doing
this?
Regards,
A.Dias