On Thu, 4 Nov 2010, Immanuel wrote:

Hello all,

I want to know how often one character occurs in a given string
and the distance from between every two occurences. (distance = other
characters between them).

You should provide "commented, minimal, self-contained, reproducible code" as asked.

And especially for a question like this one with many simple answers that RespondeRs will shower you with if only you give them a starting point.

Use tapply, strsplit, seq, nchar, unlist, diff, "-", and table for one way.

Chuck


thanks

______________________________________________
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.


Charles C. Berry                            Dept of Family/Preventive Medicine
cbe...@tajo.ucsd.edu                        UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

______________________________________________
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.

Reply via email to