table_decreasing: Frequency Table with Sorting Option

View source: R/CodeAndRoll2.R

table_decreasingR Documentation

Frequency Table with Sorting Option

Description

This function generates a frequency table of the input vector vec and allows the option to sort the table in decreasing or increasing order. It handles NA values.

Usage

table_decreasing(vec, decreasing = TRUE, useNA = "ifany")

Arguments

vec

A vector. The vector for which the frequency table is to be generated.

decreasing

Logical. Should the table be sorted in decreasing order? Default: TRUE.

useNA

A string. Specifies how to handle NA values. Can be "ifany", "always", or "no". Default: "ifany".

Value

A frequency table sorted based on the decreasing argument.

Examples

vec <- c(1, 2, 2, NA, 3, 3, 3)
table_decreasing(vec)
table_decreasing(vec, decreasing = FALSE)


vertesy/CodeAndRoll2 documentation built on Nov. 20, 2024, 5:23 a.m.