Cool, thanks a lot!  It works great!

Best,

Leon



  ----- Original Message ----- 
  From: Tim Calkins 
  To: Am Stat ;     
  Sent: Wednesday, November 01, 2006 6:55 PM
  Subject: Re: [R] Position of a specific letter in a character string


  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]]

