Skip to content
Back to formatted view

Raw Message

Message-ID: <CA+hbrhVKvP2+Z0cY-Zk3j-4ks=FRx5LQ3tZbpxe2u=TJ28S9Kw@mail.gmail.com>
Date: 2011-11-21T19:50:05Z
From: Peter Langfelder
Subject: count ties after rank?
In-Reply-To: <805CF575416A5648A33D58C35B7D3552AD604E06@it-monad.sooner.net.ou.edu>

On Mon, Nov 21, 2011 at 11:36 AM, Hao, Zhaozhe <haozhaozhe at ou.edu> wrote:
> Hello!
>
> ? ?I need to use Kruskal-Wallis test and post-hoc test (Dunn's test) for my data. But when I searched around, I only found this function: kruskal.test. But nothing for Dunn's test.
>
> ? ?So I started to write one myself. ?But ?I do not know how to count ties in the data frame. I can use for loops but it seems long and unnecessary since the rank function actually knows the ties. So can anyone give me a hint on how I can "count" the number of ties?
>

If you just need the overall number of ties in a vector (say x), you
can get it by

nTies = length(x) - length(unique(x))

This will not work if missing data are present, so you will have to
remove those first.

HTH,

Peter