[R] Question about R mode

Patrick Burns pburns at pburns.seanet.com
Thu Apr 15 10:26:00 CEST 2010


On 15/04/2010 08:52, Paul Hiemstra wrote:
> djackson at miners.utep.edu wrote:
>> Hello all,
>>
>> I am using R to perform certain calculations on huge amounts of data.
>> In short I need a function that does the mode function, ie returns the
>> most common element. I looked at the mode function in R but it seems
>> to return the type of the data element you give it. Does such a method
>> exist? I have tried googling this to no avail as all the results lead
>> me back to the mode function I do not want.
> I googled for "R calculate mode", the first hit was this result:
>
> http://www.mail-archive.com/r-help@r-project.org/msg30197.html

But be careful: creating your own function
called 'mode' will mask the standard 'mode'
function.

If you desire to remain sane, name it something
else.

Pat

>
> this is probably what you want.
>
> cheers,
> Paul
>> Thanks,
>>
>> Don
>> [[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.
>

-- 
Patrick Burns
pburns at pburns.seanet.com
http://www.burns-stat.com
(home of 'Some hints for the R beginner'
and 'The R Inferno')



More information about the R-help mailing list