x<-'GTTACTGGTACC' table(strsplit(x,'')) hth, Daniel
karena wrote: > > Hi, > > I have a string "GGGGGGCCCAATCGCAATTCCAATT" > > What I want to do is to count the percentage of each letter in the string, > what string functions can I use to count the number of each letter > appearing in the string? > > For example, the letter "A" appeared 6 times, letter "T" appeared 5 times, > how can I use a string function to get the these number? > > thanks, > > karena > -- View this message in context: http://r.789695.n4.nabble.com/R-string-functions-tp3600484p3600568.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.