[R] pattern search
bcarvalh at jhsph.edu
Wed Apr 4 17:27:02 CEST 2007
On Apr 4, 2007, at 10:49 AM, Schmitt, Corinna wrote:
> Dear R-experts,
> I'm looking for an easy possibility for pattern search. I have got a
> string and a special pattern. I would like to know if the pattern
> appears in the string, if yes where does it appear (position) and the
> number of appearance.
> Text = c("If the sun shines, no clouds should be seen in the sky!")
> SearchPattern = c("the")
> NumberOfAppearance = 0
> NumberOfLetters = 0
> --> NumberOfAppearance should be 2 in the end
> How can I get the string length (=number of letters stored in Text)?
> Has anyone a good idea?
> Thanks, Corinna
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help