Say you have the string x in a matrix x<-c('a,..gGGtTaac<!T','caaGGTT,,.!!@CC') x<-matrix(x)
remove all punctuation: x1<-gsub('[[:punct:]]','',x) x1 convert all letter to lowercase x2<-gsub('(\\w*)','\\L\\1',x1,perl=T) x2 now for each row split the string and table it. apply over all rows in the matrix apply(x2,1,function(x) table(strsplit(x,''))) HTH, Daniel -- View this message in context: http://r.789695.n4.nabble.com/For-help-in-R-coding-tp3639413p3642655.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.