getMode: compute the mode of column within a data frame

Description Usage Arguments Value Author(s) Examples

View source: R/getMode.R

Description

this function computes the modal value of a specified column of a data frame

Usage

1
getMode(df, col, side = c("lower", "upper"))

Arguments

df

a data frame

col

a column name or column number

side

in case of a tie, which side should be returned

Value

a vector

Author(s)

Tim Appelhans, Florian Detsch

Examples

1
2
3
4
5
6
df <- data.frame(a = c(1, 2, 2, 2, 3, 3, 3, 4, 5, 6, 7), 
                 b = c("a", "b", "c", "c", "d", "e", "e", "e", "e", "f", "g"))

getMode(df, "a")
getMode(df, "a", "upper")
getMode(df, 2)

environmentalinformatics-marburg/Rsenal documentation built on Sept. 23, 2018, 5:17 a.m.