On Thu, Jun 4, 2009 at 12:45 PM, Rainer M Krug wrote:
> On Thu, Jun 4, 2009 at 12:36 PM, Patrick Burns
> wrote:
>> How about:
>>
>> order(x, runif(length(x)))
>
> Thanks - that is really elegant.
One thing:
it is saver to use sample(length(x)) instead of runif(length(x)), as
runif() might also
On Thu, Jun 4, 2009 at 12:36 PM, Patrick Burns wrote:
> How about:
>
> order(x, runif(length(x)))
Thanks - that is really elegant.
Rainer
>
>
>
> Patrick Burns
> patr...@burns-stat.com
> +44 (0)20 8525 0696
> http://www.burns-stat.com
> (home of "The R Inferno" and "A Guide for the Unwilling S
How about:
order(x, runif(length(x)))
Patrick Burns
patr...@burns-stat.com
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of "The R Inferno" and "A Guide for the Unwilling S User")
Rainer M Krug wrote:
Sorry for replying to my own post, but I found a solution. Still, a
more elegant solu
Sorry for replying to my own post, but I found a solution. Still, a
more elegant solution would be preferred.
On Thu, Jun 4, 2009 at 12:02 PM, Rainer M Krug wrote:
> Hi
>
> I want to use order() to get the order of a vector.
>
> But I would need a different behavior when ties occur: similar to th
Hi
I want to use order() to get the order of a vector.
But I would need a different behavior when ties occur: similar to the
parameter ties.method = "random" in the rank() function, I would need
to randomise the ties. Is this possible?
Example:
x <- rep(1:10, 2)
order(x)
[1] 1 11 2 12 3 13
5 matches
Mail list logo