mode_factor: Find the mode of a categorical variable

Description Usage Arguments Details Author(s) References Examples

View source: R/mode_factor.R

Description

This function finds the mode of a categorical variable

Usage

1

Arguments

x

a factor

Details

The mode is the most frequently occuring level of a categorical variable. This function returns the mode of a categorical variable. If there is a tie for the most frequent level, it returns all modes.

Author(s)

Adam Petrie

References

Introduction to Regression and Modeling

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
	data(EX6.CLICK)
  mode_factor(EX6.CLICK$DeviceModel)
  
  #To see how often it appears try sorting a table
  sort( table(EX6.CLICK$DeviceModel),decreasing=TRUE )
  
  x <- c( rep(letters[1:4],5), "e", "f" )  #multimodel
  mode_factor(x)

  

regclass documentation built on March 26, 2020, 8:02 p.m.