Hi!

28.09.2012 08:41, Atte Tenkanen 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?

How about this:

--- code ---

g1<- c(2,1,1,4,6,3)
g2<- c(2,1,1,6,4,3)
t1<- c(1,4,6)
t2<-c(9,8)

!is.na(sum(match(t1,g1)))
[1] TRUE
!is.na(sum(match(t1,g2)))
[1] TRUE
!is.na(sum(match(t2,g1)))
[1] FALSE

--- code ---

Kind regads,
Kimmo

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to