[R] Relative frequency on a character vector

ADias diasandre at gmail.com
Tue Jan 18 13:51:05 CET 2011


I have this character vector:

A<-c("Tell me how many different letter this vector has?")

Is there a way with R that it can let me know how many different letters I
have on this vector?

If I use nchar(A) que gives me the number 50. With this function he is
counting all the letters present and also spaces between the words. Can we
also not count the spaces between words?

Then after I knew how many different letters there were on the vector I
wanted to table the number of times each letter is present to calculate the
relative frequency of each.

Is this possible with R?

Many thanks
View this message in context: http://r.789695.n4.nabble.com/Relative-frequency-on-a-character-vector-tp3221319p3221319.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list