[R] Obtaining average ranking from matrix of frequencies
Benjamin Goudey
bwgoudey at gmail.com
Wed Apr 1 15:53:19 CEST 2009
Thanks heaps. Is there a neat way to do the same for the standard deviation?
Cheers
Ben
On Wed, Apr 1, 2009 at 11:59 PM, Dimitris Rizopoulos
<d.rizopoulos at erasmusmc.nl> wrote:
> say 'm' is your matrix, then try
>
> rowMeans(m * col(m))
>
>
> I hope it helps.
>
> Best,
> Dimitris
>
>
> bwgoudey wrote:
>>
>> I have a small matrix where the columns represents a ranking and the
>> values
>> are the number of times each ranking was obtained eg
>> 1 2 3
>> x 1 2 0
>> y 0 1 2
>> z 2 0 1
>>
>> I'd like to be able to return an average of the ranking obtained
>> average
>> x 1.67
>> y 2.67
>> z 1.67
>>
>> Whats the nicest way to do this? I'm new to the language and looking for
>> an
>> elegant solution :)
>>
>> Thanks
>> Ben
>>
>>
>>
>>
>
> --
> Dimitris Rizopoulos
> Assistant Professor
> Department of Biostatistics
> Erasmus University Medical Center
>
> Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
> Tel: +31/(0)10/7043478
> Fax: +31/(0)10/7043014
>
More information about the R-help
mailing list