[R] regexpr
runner
sunnyside500 at gmail.com
Fri Jun 29 18:37:52 CEST 2007
Hi,
I 'd like to match each member of a list to a target string, e.g.
------------------------------
mylist=c("MN","NY","FL")
g=regexpr(mylist[1], "Those from MN:")
if (g>0)
{
"On list"
}
------------------------------
My question is:
How to add an end-of-string symbol '$' to the to-match string? so that 'M'
won't match.
Of course, "MN$" will work, but i want to use it in a loop; "mylist[i]" is
what i need. I tried "mylist[1]$", but didn't work. So why it doesn't
extrapolate? How to do it?
Thanks a lot!
--
View this message in context: http://www.nabble.com/regexpr-tf4000743.html#a11363041
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list