Skip to content
Back to formatted view

Raw Message

Message-ID: <f880f18d0911021126l3d2772edw9ac757811327a599@mail.gmail.com>
Date: 2009-11-02T19:26:27Z
From: Ashta
Subject: Frequency
In-Reply-To: <317737de0911021045u7a806a1ewdb87c2c30c9017e4@mail.gmail.com>

Thank you Jorge and

> res <- table(unlist(x))
> res[order(res, decreasing = TRUE)]
> # 10  4  6  3  5  7  9 18
> #  3  2  2  1  1  1  1  1

This one works fine for me.  Is it possible to transpose it?
I tried  t(res[order(res, decreasing = TRUE)]), but it did not work!

I want the result like this
10  2
 4   2
 6   2
 3   1
  .  .
  .  .




On Mon, Nov 2, 2009 at 1:45 PM, Jorge Ivan Velez
<jorgeivanvelez at gmail.com> wrote:
> Hi Val,
>
> Here is a suggestion:
>
> res <- table(unlist(x))
> res[order(res, decreasing = TRUE)]
> # 10 ?4 ?6 ?3 ?5 ?7 ?9 18
> # ?3 ?2 ?2 ?1 ?1 ?1 ?1 ?1
>
> HTH,
> Jorge
>
>
> On Mon, Nov 2, 2009 at 1:35 PM, Val <> wrote:
>
>> BAYESIAN INFERENCES FOR MILKING TEMPERAMENT IN CANADIAN HOLSTEINS
>>
>> Hi All,
>>
>> I have a data ?set "x" ?with several variables. Sample of the data is shown
>> below
>>
>> ?V1 ?v2 ?v3 ? v4
>>
>> ? 5 ? ?6 ? ?9 ? 10
>>
>> ?3 ? ?4 ? ?7 ? 10
>>
>> ?4 ? ?6 ? 10 ? 18
>>
>>
>>
>> I want the frequency ?of each ?data point sorted by their occurrence.
>>
>>
>>
>> Below is the output that I want
>>
>> 10 ? ?=3
>>
>> 6=2
>>
>> 4=2
>>
>> 9=1
>>
>> 5=1
>>
>> 7=1
>>
>> 3=1
>>
>> How do I do it in R?
>>
>>
>>
>> Thanks in advance
>>
>>
>>
>> Val
>>
>> ? ? ? ?[[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
> ? ? ? ?[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>