Yhe question of finding the mode of a dataset has been discussed previously in the list not only for categorical data :
search "How can I get the mode" in the search engine of the list. Hope this helps. Romain. Selon Uwe Ligges <[EMAIL PROTECTED]>: > LONG Yu wrote: > > > 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 > > > > ______________________________________________ > > [EMAIL PROTECTED] mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html > > > See ?which.max > > Uwe Ligges > > ______________________________________________ > [EMAIL PROTECTED] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html > ______________________________________________ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
