[R] Partial comparison in string vector
m_olshansky at yahoo.com
Wed Aug 22 01:57:04 CEST 2007
Use grep("^e",x) if you are looking for the entries
where e is the first character.
--- Vladimir Eremeev <wl2776 at gmail.com> wrote:
> seq(along=x) %in% grep("e",x)
> Steve Powell-4 wrote:
> > I have a vector of strings
> > x=c("w","ex","ee")
> > And I want to get a logical vector showing the
> positions where my search
> > string "e" matches the elements partially, i.e. is
> at least the left-hand
> > part of the target strings, i.e. I want to get a
> vector FALSE TRUE TRUE.
> View this message in context:
> Sent from the R help mailing list archive at
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained,
> reproducible code.
More information about the R-help