[R-sig-Epi] mode of a character variable
Peter Dalgaard
p.dalgaard at biostat.ku.dk
Fri Apr 11 11:00:06 CEST 2008
Henrik Kallberg wrote:
> Dear All!
> I have tried to find a function for searching for the most common character set within a variable. I have not found a solution though. Maybe any smarthead out there could enlight me. To describe what i'm after the metacode looks like this:
> var
> A A
> A A
> C C
> G G
> cm<-FindModeChar(var)
> cm
> A A
> Best regards Henrik
>
>
>
How about which.max(table(var)) ?
--
O__ ---- Peter Dalgaard Øster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-sig-Epi
mailing list