Learn R Programming

fctutils (version 0.0.7)

ft_level_order: Get Order of Factor Levels in Data

Description

Returns a vector indicating the order in which factor levels appear in the data.

Usage

ft_level_order(factor_vec)

Value

A numeric vector representing the order of levels.

Arguments

factor_vec

A factor vector.

Author

Kai Guo

Examples

Run this code
# Example factor vector
factor_vec <- factor(c('banana', 'apple', 'cherry', 'apple', 'banana'))

# Get level order
ft_level_order(factor_vec)

Run the code above in your browser using DataLab