[R] re-ordering a vector by name

Peter Dalgaard p.dalgaard at biostat.ku.dk
Sat May 8 10:55:59 CEST 2004


"Liaw, Andy" <andy_liaw at merck.com> writes:

> Reid: It isn't a memory problem.  For vectors of length 6e5, I killed the R
> process after more than 5 hours on an Opteron 248.  The R process was taking
> up about 114MB of RAM, out of 8GB in the box.  I'm rather surprised that
> such seemingly simple operation would take so long, especially when sorting
> such vectors is very fast.  What am I missing?

An opportunity to fix some horribly inefficient code in subscript.c

There's a double for-loop inside stringSubscript, which will make the
whole operation O(N^2). The match() function presumably does it in 
O(N log N) or there abouts.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list