Re: [R] counting characters starting point

2012-02-20 Thread Rui Barradas
Hello, Try seq1 <- 'PQRTUWXY' seq2 <- 'AQSDSSDHRS' seq3 <- 'EEZYJKFFBHO' ref1 <- 'U' ref2 <- 'S' ref3 <- 'Y' fun <- function(seq, chr){ f <- function(x, seq, chr){ pos <- regexpr(x, seq) if(pos < 0) 99 else

[R] counting characters starting point

2012-02-20 Thread Juliet Ndukum
I have three character strings represented below as seq1, seq2, and seq3. Each string has a reference character different from the other. Thus, for seq1, the reference character is U, seq2, S (3rd S from left where A is leftmost character) and for seq3 Y. seq1 = PQRTUWXYseq2 = AQSDSSDHRSseq3 = E