Try this: table(strsplit(A, "?")[[1]])
On Tue, Jan 18, 2011 at 10:51 AM, ADias <diasan...@gmail.com> wrote: > > Hi, > > 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 > A.Dias > -- > 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. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.