Skip to content
Back to formatted view

Raw Message

Message-ID: <CF99BBA00A3F5D4183C2FA33089FBC3403788434@EX01.staff.smu.edu.sg>
Date: 2004-11-23T08:19:09Z
From: LONG Yu
Subject: Mode?

Dear all, 

I want to find out the mode for a data set, anyone knows how to do it in
R? 
I tried the codes below, but it seems too long:

tt<-table(data1)         #get the frequency tables of data1
oo<-order(tt);            #get the order of frequencies 
len<-length(tt)           #the length of the tables
mm<-oo[len];            #the last number of oo is the position  
tt[mm]                     #we can get the mode 


Thank you everybody first!

Regards, 
Long Yu