toFactor: Convert to Factor with unique Values as Levels

View source: R/convert.R

toFactorR Documentation

Convert to Factor with unique Values as Levels

Description

In contrast to the default behaviour of base::as.factor, this function uses the unsorted unique values of x as levels and not sorted unique values.

Usage

toFactor(x)

Arguments

x

vector to be converted to factor

Examples

x <- c("b", "c", "a")

as.factor(x) # Levels: a b c

toFactor(x) # Levels: b c a

KWB-R/kwb.utils documentation built on April 1, 2024, 7:12 a.m.