[R] String Matching

MacQueen, Don macqueen1 at llnl.gov
Thu Aug 13 21:42:00 CEST 2015


I haven't tested this, but what about:


df <- data.frame(mtch=c(matchString, string1, string2))

grep(searchString, df$mtch, ignore.case=FALSE)

Depending on what your next step is, you might prefer grepl.


Sometimes using fixed=TRUE in grep() helps.

-Don

-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 8/12/15, 8:51 AM, "R-help on behalf of Kevin Kowitski"
<r-help-bounces at r-project.org on behalf of k.kowitski at icloud.com> wrote:

>>df<-as.data.frame(c(matchString, string1, string2))
>>df
>                                                         c(matchString,
>string1, string2)
>1 09:11:57.259 - Assay File Processing Thread - INFO -
>SolenoidCycleMessage: Addr = 0x03
>2                 
>23:12:43.22 - Test
>3                 
>           test
>>grep(searchString, df, ignore.case=FALSE)
>i



More information about the R-help mailing list