i_freq_min: An internal function to return an index from among sparse...

Description Usage Arguments Value Note See Also Examples

View source: R/collapse.R

Description

This function looks at a table, finds indices of the least frequent response category (or categories), and returns one as a starting point for collapse().

Usage

1
i_freq_min(tbl, return_which = c("min", "max"))

Arguments

tbl

A table, usually one that was made from a vector of response categories.

return_which

In situations in which more than one response category is the least frequent (i.e., with the lowest frequency count), should the function return the minimum response (i.e., the leftmost category if sorted in ascending order) or the maximum response (i.e., the rightmost category if sorted in ascending order). The default is "min" for "minimum" or the "rightmost" response option. This parameter is only relevant when more than one response category is tied for being the least frequent.

Value

A single numeric index in tbl that tells collapse() which response category to start with.

Note

This is intended as an internal function to the collapse() function. Use with care for other purposes.

See Also

collapse()

Examples

1
2
3
4
5
6
7
8
## Not run: 

sparse_vector <- c(1, 1, 1, 1, 1, 2, 2, 3, 3, 3, 3, 3, 4, 4, 5, 5)
i_freq_min(table(sparse_vector))
table(sparse_vector) |> i_freq_min()


## End(Not run)

jameswgriffith/jamie documentation built on Dec. 20, 2021, 9:03 p.m.