getMode: compute the mode of column within a data frame

View source: R/getMode.R

getModeR Documentation

compute the mode of column within a data frame

Description

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

Usage

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

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 July 28, 2023, 6:09 a.m.