From: Prof Brian Ripley (email@example.com)
Date: Wed 21 Nov 2001 - 04:35:45 EST
On Tue, 20 Nov 2001, Agustin Lobo wrote:
> I'm doing
> m <- match(matriz, origen, 0)
> where matriz is a 270x900 matrix and
> origen a 11675 elements vector, and is taking
> a very long time.
> Is match a function
> implemented in C? If not, would a C
All of R is implemented in C or Fortran, ultimately. But you could do
function (x, table, nomatch = NA, incomparables = FALSE)
if (!is.logical(incomparables) || incomparables)
.NotYetUsed("incomparables != FALSE")
.Internal(match(if (is.factor(x)) as.character(x) else x,
if (is.factor(table)) as.character(table) else table,
to see that it is a direct call to an internal function, and they
are in C.
> code be faster?
The internal C code (do_match in src/main/unique.c) uses hashing,
so unless that is not doing a good job on your particular data it ought
to be about as fast as possible.
You could have looked at the source code in the same way I did: that's
the beauty of an open-source system.
-- Brian D. Ripley, firstname.lastname@example.org Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: email@example.com _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
This archive was generated by hypermail 2.1.3 : Thu 17 Jan 2002 - 11:10:09 EST