Re: [R] Ordering long vectors

2003-06-09 Thread Göran Broström
On Mon, 9 Jun 2003, Prof Brian Ripley wrote: > On Sun, 8 Jun 2003, Göran Broström wrote: > > > On Sun, 8 Jun 2003, Thomas Lumley wrote: > > > > > On Sat, 7 Jun 2003, [ISO-8859-1] Göran Broström wrote: > > > > > > > > > > > I need to order a long vector of integers with rather few unique values.

Re: [R] Ordering long vectors

2003-06-09 Thread Prof Brian Ripley
On Sun, 8 Jun 2003, Göran Broström wrote: > On Sun, 8 Jun 2003, Thomas Lumley wrote: > > > On Sat, 7 Jun 2003, [ISO-8859-1] Göran Broström wrote: > > > > > > > > I need to order a long vector of integers with rather few unique values. > > > This is very slow: > > > > > > I think the culprit is

Re: [R] Ordering long vectors

2003-06-08 Thread Göran Broström
On Sun, 8 Jun 2003, Thomas Lumley wrote: > On Sat, 7 Jun 2003, [ISO-8859-1] Göran Broström wrote: > > > > > I need to order a long vector of integers with rather few unique values. > > This is very slow: > > > I think the culprit is > > src/main/sort.c: orderVector1 > > /* Shell sort isn'

Re: [R] Ordering long vectors

2003-06-08 Thread Thomas Lumley
On Sat, 7 Jun 2003, [ISO-8859-1] Göran Broström wrote: > > I need to order a long vector of integers with rather few unique values. > This is very slow: I think the culprit is src/main/sort.c: orderVector1 /* Shell sort isn't stable, but it proves to be somewhat faster to run a fina

Re: [R] Ordering long vectors

2003-06-08 Thread Thomas Lumley
On Sun, 8 Jun 2003, [ISO-8859-1] Göran Broström wrote: > On Sat, 7 Jun 2003, Göran Broström wrote: > > > > > I need to order a long vector of integers with rather few unique values. > > This is very slow: > > > > > x <- sample(rep(c(1:10), 5)) > > > system.time(ord <- order(x)) > > [1] 189.18

Re: [R] Ordering long vectors

2003-06-08 Thread Göran Broström
On Sat, 7 Jun 2003, Göran Broström wrote: > > I need to order a long vector of integers with rather few unique values. > This is very slow: > > > x <- sample(rep(c(1:10), 5)) > > system.time(ord <- order(x)) > [1] 189.18 0.09 190.48 0.00 0.00 > > But with no ties > > > y <- sample(50

[R] Ordering long vectors

2003-06-07 Thread Göran Broström
I need to order a long vector of integers with rather few unique values. This is very slow: > x <- sample(rep(c(1:10), 5)) > system.time(ord <- order(x)) [1] 189.18 0.09 190.48 0.00 0.00 But with no ties > y <- sample(50) > system.time(ord1 <- order(y)) [1] 1.18 0.00 1.18 0.00 0.0