Re: [R] matching vectors

2009-03-17 Thread jim holtman
You can use something like this to make sure that h2 is a subset of h1 in consecutive order: > h1 <- 1:50 > h2 <- 25:30 > hm <- match(h2, h1) > all(diff(hm) == 1) [1] TRUE > On Tue, Mar 17, 2009 at 6:42 AM, emj83 wrote: > > I have two numerical vectors; hun2 is a subset of hun1: > >> hun1 >  [

[R] matching vectors

2009-03-17 Thread emj83
I have two numerical vectors; hun2 is a subset of hun1: > hun1 [1] 147 198 141 170 184 136 150 134 144 161 124 103 107 110 121 79 106 51 [19] 102 109 52 71 52 80 95 78 75 96 101 107 107 80 71 49 71 64 [37] 58 68 75 85 55 52 70 90 98 90 100 98 74 78 60 69 106 103