Learn R Programming

campsis (version 1.9.2)

preserve_column_levels: Preserve Existing Column Value Order as Factor Levels

Description

Converts target columns into factors using their current unique row appearance order as the factor levels.

Usage

preserve_column_levels(x, cols)

Value

a data frame with updated factor columns.

Arguments

x

a data frame or tibble.

cols

a character vector of column names to convert.