Hi Santosh,

you may also try

require(stringr)
x <- "abcdefghijklcd"
str_locate_all(x,"cd")


On Sun, Dec 5, 2010 at 1:21 PM, Petr Savicky <savi...@cs.cas.cz> wrote:

> On Sun, Dec 05, 2010 at 08:04:08AM +0530, Santosh Srinivas wrote:
> > I am trying to find the function where I can search for a pattern in a
> > text string (I thought I could use grep for this but no :().
> >
> > > x
> > [1] "abcdefghijkl"
> >
> > I want to find the positions (i.e. equivalent of nchar) for "cd" and
> > in case there are multiple hits .. then the results as a array
>

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

Reply via email to