lazyFactorCoding: Efficient coding of factor levels

View source: R/lazyFactorCoding.R

lazyFactorCodingR Documentation

Efficient coding of factor levels

Description

This function eases the process of generating factor variables with relevant labels. All variables in a data.frame with less than a user set number of levels result in a line which suggests levels and labels. The result can then be modified for use.

Usage

lazyFactorCoding(data, max.levels = 10)

Arguments

data

Data frame in which to search for categorical variables.

max.levels

Treat non-factor variables only if the number of unique values less than max.levels. Defaults to 10.

Details

The code needs to be copy-and-pasted from the R-output buffer into the R-code buffer. This can be customized for the really efficiently working people e.g. in emacs.

Value

R-code one line for each variable.

Author(s)

Thomas Alexander Gerds

Examples

data(Diabetes)
lazyFactorCoding(Diabetes)


Publish documentation built on Jan. 18, 2023, 1:08 a.m.