Computes the mode given a vector of data.

metric_mode(x, na.rm = FALSE)

Arguments

x

A vector of data.

na.rm

A logical indicating if missing values (including NaN) should be removed. Default: FALSE

Value

A single numeric or integer value.

Details

Be forewarned that this method of obtaining the mode does not take into consideration ties. That is, only the first group with the maximum value is returned. If a second group also has a similar count, this group will not be returned.

Recovery Use

The mode should be used when computing latent class recovery among subjects.

Examples

# Sample class-data x = c(0, 0, 0, 1, 1, 2) metric_mode(x)
#> [1] 0