[R] What is wrong with this code?

Jim Lemon jim at bitwrit.com.au
Thu Jul 1 12:44:13 CEST 2010


On 07/01/2010 07:56 AM, Cable, Samuel B Civ USAF AFMC AFRL/RVBXI wrote:
>> Okay, here is a reproducible example of a possible solution (actually
>> it
>> probably does not do what you want but it's a start for discussion.
>> Note it is actual code and data which is what is needed.
>> =======================================================
>> str1<- "abc"
>> str2<- "abcd"
>> str3<- "efgh"
>>
>> grep(str1, str2)
>> grep(str1,str3)
>> =======================================================
So what's wrong with:

pmatch(str1,str2,nomatch=0)
[1] 1
pmatch(str1,str3,nomatch=0)
[1] 0

Jim



More information about the R-help mailing list