Hi Ragia,
The basic method is to use "table" and examine the result:
> a<-matrix(c(3,3,4,3,6,6),nrow=2)
> b<-matrix(c(3,3,4,4,6,6),nrow=2)
> table(a)
a
3 4 6
3 1 2
but you can get the modal value directly like this:
library(prettyR)
Mode(a)
[1] "3"
Mode(b)
[1] ">1 mode"
Jim
On Mon, Jun 15, 201
Dear group,
I have the following integer object
> a
3 4 6
3 3 6
how to get the most frequent value (it should be 3)
and get nothing if no frequent one and all is equal
3 4 6
3 4 6
Thanks in advance
Ragia
[[alternative HTML version deleted
2 matches
Mail list logo