[R] How to test if there is a subvector in a longer vector
Atte Tenkanen
attenka at utu.fi
Fri Sep 28 20:19:34 CEST 2012
Thank you!
_______________
Lähettäjä: Berend Hasselman [bhh at xs4all.nl]
Lähetetty: 28. syyskuuta 2012 10:47
Vastaanottaja: Atte Tenkanen
Cc: R help
Aihe: Re: [R] How to test if there is a subvector in a longer vector
On 28-09-2012, at 07:41, Atte Tenkanen <attenka at utu.fi> wrote:
> Sorry. I should have mentioned that the order of the components is important.
>
> So c(1,4,6) is accepted as a subvector of c(2,1,1,4,6,3), but not of c(2,1,1,6,4,3).
>
> How to test this?
See this discussion for a variety of solutions.
http://r.789695.n4.nabble.com/matching-a-sequence-in-a-vector-td4389523.html#a4393453
Berend
More information about the R-help
mailing list