Petri Palmu <petri.palmu <at> geneos.fi> writes:
> I'm using gregexpr(). As a result something like this:
>
> # starting positions of the match:
> [[1]]
> [1] 7 18
>
> # length of the matched text:
> attr(,"match.length")
> [1] 4 4
>
> Now, I'd like to have a matrix,
> 7 4
> 18 4
>
something like
x1 = gregexpr("iss",c("mississippi"))
x2 = rbind(x1[[1]],attr(x1[[1]],"match.length"))
x2
[,1] [,2]
[1,] 2 5
[2,] 3 3
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html