Skip to content
Prev 318648 / 398503 Next

Help searching a matrix for only certain records

If you are using matrices, then here is several ways of doing it for
size 300,000.  You can determine if the difference of 0.1 seconds is
important in terms of the performance you are after.  It is taking you
more time to type in the statements than it is taking them to execute:
+     sample(c("SAO ", "FL-15", "Other"), n, TRUE, prob = c(1,2,1000))
+     , nrow = n
+     , dimnames = list(NULL, "REC.TYPE")
+     )
FL-15  Other   SAO
   562 299151    287
user  system elapsed
   0.17    0.00    0.17
user  system elapsed
   0.05    0.00    0.05
+                             , c("SAO ", "FL-15")
+                             , nomatch = 0) != 0
+                             ,, drop = FALSE]
+             )
   user  system elapsed
   0.03    0.00    0.03
[1] TRUE
[1] TRUE

        
On Sun, Mar 3, 2013 at 11:22 AM, Jim Holtman <jholtman at gmail.com> wrote: