here's one way
> x <- "1234_5"
> regexpr("_",x)
[1] 5
attr(,"match.length")
[1] 1
so
> regexpr("_",x)[1]
[1] 5
there's probably an easier way, but this works.
tim
On 11/2/06, Am Stat <amstat2006@gmail.com> wrote:>
> Dear useR,
>
> x is a character string
>
> In R:
>
> > x<- '32159_3'
>
> Which function could enable me to determine the position of underscore in
> x? In here, the underscore is on the 6th digit of x.
>
>
> ---
> Yours Sincerely
>
> Leon
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
--
Tim Calkins
0406 753 997
[[alternative HTML version deleted]]