You can try the following:
a == grep("ear", a, value=T)
-Christos
Christos Hatzis, Ph.D.
Nuvera Biosciences, Inc.
400 West Cummings Park
Suite 5350
Woburn, MA 01801
Tel: 781-938-3830
www.nuverabio.com
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
Sent: Saturday, January 20, 2007 1:31 PM
To: [email protected]
Subject: [R] simple q: returning a logical vector of substring matches
I'm a relative R novice, and sometimes the simple things trip me up.
Suppose I have
a <- c("apple", "pear")
and I want a logical vector of whether each of these strings contains "ear"
(in this case, F T). What is the idiom?
Quizzically,
Mark Lindeman
______________________________________________
[email protected] 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.
______________________________________________
[email protected] 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.