[R] Thoughts for faster indexing

Ben Bolker bbolker at gmail.com
Thu Nov 21 19:59:13 CET 2013


Neal Fultz <nfultz <at> gmail.com> writes:

> 
> Noah,
> 
> If N is # of rows, k is # of unique IDs
> 
> Using which() is O(N), using which() in a loop is going to  be O(Nk);
> 
> sorting the entire data is O(N ln N) and then you can process it in
> contiguous blocks, no which required.
> 
> -Neal
> 

  You might also take a look at the 'dplyr' package on Github: it's
next-gen plyr, engineered for performance ...

https://github.com/hadley/dplyr



More information about the R-help mailing list