Skip to content
Back to formatted view

Raw Message

Message-ID: <B4F37A97-CEDA-4A98-B2CF-8E641CA098E4@xs4all.nl>
Date: 2012-09-28T07:47:55Z
From: Berend Hasselman
Subject: How to test if there is a subvector in a longer vector
In-Reply-To: <7953BA1D7779E746994B38A00362416C0B31E72B@exch-mbx-02.utu.fi>

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