[R] String match

Christofer Bogaso bogaso.christofer at gmail.com
Sat Jun 4 19:28:52 CEST 2016


Hi again,

I am facing trouble to match a vector strings. Let say I have below
full string vector

WhereToLook = c("ultracemco.bo.openam"   ,  "ultracemco.bo.higham"
,"ultracemco.bo.lowam"   ,   "ultracemco.bo.closeam"   ,
"ultracemco.bo.volumeam"   ,"ultracemco.bo.adjustedam")

WhatToLook = c("volume", "close")

Basically I need to find the positions of WhatToLook in WhereToLook.
So my code goes as below :

> pmatch(tolower(colnames(WhereToLook)), WhatToLook)
integer(0)


Although I was expecting my code would point 5 & 4 respectively.

Appreciate if someone points as correct code for above case.

Thanks,



More information about the R-help mailing list