[R] Index of Character

Erik Iverson eriki at ccbr.umn.edu
Thu Jul 1 05:04:07 CEST 2010


harsh yadav wrote:
> Hi,
> 
> I am a newbie to R and this may be too simple to ask.
> 
> I am trying to find out a string function in R that returns the index of a
> character.
> 
> For e.g. indexOf("Test1234", '4') would return 8.

 > regexpr("4", "Test1234")
[1] 8
attr(,"match.length")
[1] 1



More information about the R-help mailing list