Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in R Programming by (7.3k points)
edited by

In R, mean() and median() are standard functions that do what you'd expect.  mode() tells you the internal storage mode of the object, not the value that occurs the most in its argument. But is there is a standard library function that implements the statistical mode for a vector (or list)?

1 Answer

0 votes
by
edited by

There is a package called modeest which enables to compute an estimate of the mode of a univariate distribution. Its dependency genefilter is part of Bioconductor, so it needs to be installed using Bioconductor methods.

For example:

install.packages("modeest")

install.packages("BiocManager")

library("BiocManager")

BiocManager::install("genefilter") 

 To find mode:

mySample <- c(19, 4, 5, 7, 29, 19, 29, 13, 25, 19)

library(modeest)

mlv(mySamples, method = "mfv")

[1] 51

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...