Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

freq.min

Minimum and maximum frequencies of a vector


Description

Minimum and maximum frequencies of a vector.

Usage

freq.min(x,na.rm = FALSE)
freq.max(x,na.rm = FALSE)

Arguments

x

A numerical/integer vector with data but without NAs.

na.rm

TRUE or FAlSE for remove NAs if exists.

Details

Those functions are the same with max(table(x) or min(table(x)) but with one exception. freq.min and freq.max will return also which value has the minimum/maximum frequency. More Efficient than max(table(x) or min(table(x)).

Value

A vector with 2 values, the value with minimum/maximum frequency and the frequency.

Author(s)

Manos Papadakis

R implementation and documentation: Manos Papadakis <papadakm95@gmail.com> and Marios Dimitriadis <kmdimitriadis@gmail.com>.

See Also

Examples

x <- rnorm(100)
f1 <- freq.min(x) 
f2 <- freq.max(x) 
# f1r <- min(table(x))
# f2r <- max(table(x))
# f1[2]==f1r ## the frequencies are the same
# f2[2]==f2r ## the frequencies are the same

Rfast

A Collection of Efficient and Extremely Fast R Functions

v2.0.1
GPL (>= 2.0)
Authors
Manos Papadakis, Michail Tsagris, Marios Dimitriadis, Stefanos Fafalios, Ioannis Tsamardinos, Matteo Fasiolo, Giorgos Borboudakis, John Burkardt, Changliang Zou, Kleanthi Lakiotaki and Christina Chatzipantsiou.
Initial release
2020-09-13

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.