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

mode_order

Calculate the mode, and use original order to break ties


Description

mode_order() calculates the mode of a vector, mostly used as the default .resolve option in fixed_force()

Usage

mode_order(x)

Arguments

x

Vector to calculate the mode of.

Details

In the case of ties, the first-ordered value in the vector wins.

Examples

x <- c(1, 2, 2, NA, 5, 3, 4)
mode_order(x)

# Ties are broken by order
x <- c(2, 2, 1, 1)
mode_order(x)

pmdplyr

'dplyr' Extension for Common Panel Data Maneuvers

v0.3.3
MIT + file LICENSE
Authors
Nick Huntington-Klein [aut, cre] (<https://orcid.org/0000-0002-7352-3991>), Philip Khor [aut] (<https://orcid.org/0000-0002-8333-1256>)
Initial release

We don't support your browser anymore

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