fix_factors: Trim excess factor levels from columns of a data frame

View source: R/fix_factors.R

fix_factorsR Documentation

Trim excess factor levels from columns of a data frame

Description

This function goes through all columns of a data frame, and removes excess levels from columns of class factor, while leaving other columns unchanged. It is intended to be used after filtering a data frame, so that excess levels do not cause errors or confusion in downstream processes.

Usage

fix_factors(data)

Arguments

data

a data frame, with 0 or more columns of class factor

Value

a data frame of the same dimensions as data


mjdufort/miscHelpers documentation built on Feb. 4, 2024, 7:44 p.m.