grep always output [1]1, but not the real index
a = "d123 d123 d123 asdf asd D123"
grep("d", a)
[1] 1
There are several "d" in the variable a, but not all the indices are displayed. I tried http://rfunction.com/archives/1481 and it works.
Why the simple one does not?
It is supposed to be equivalent to
unlist(gregexpr("d",a)[1])