Re: [R] gregexpr() - length of the matched text to a vector

From: Petri Palmu <petri.palmu_at_geneos.fi>
Date: Thu 12 Jan 2006 - 01:38:08 EST

Now I found a solution that seems to work OK for me: attributes(gregexpr(expression, text)[[1]])

Petri

At 15:00 11.1.2006 +0100, Petri Palmu wrote:

>Hi,
>
>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
>
>but I don't know how to handle the attr(,"match.length") ...?
>The format of the output is pretty unclear to me in that respect.
>
>Thanks in advance,
>Petri
>----------------------
>Petri Palmu, M.Soc.Sc
>Statistician
>petri.palmu@geneos.fi
>
>Geneos Ltd
>tel:+358 9 4366 2512
>gsm: +35840 55 249 55
>fax:+ 358 9 4366 2523
>P.O. Box 25 (Tukholmankatu 2)
>FIN-00251, Helsinki, Finland
>
>______________________________________________
>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



Petri Palmu, M.Soc.Sc
Statistician
petri.palmu@geneos.fi

Geneos Ltd

tel:+358 9 4366 2512
gsm: +35840 55 249 55
fax:+ 358 9 4366 2523

P.O. Box 25 (Tukholmankatu 2)
FIN-00251, Helsinki, Finland

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 Received on Thu Jan 12 01:56:18 2006

This archive was generated by hypermail 2.1.8 : Thu 12 Jan 2006 - 06:09:15 EST