recode_factor: Recode columns to factor in a data frame.

Description Usage Arguments Value

Description

The data frame is recoded according to a correspondance table.
The correpondance table contains a least three columns : column, value and factor.
An optional table data_levels contains ordered levels for each column. It contains at least three fields : column, order, level.

Usage

1
recode_factor(data, data_recode, data_levels = NULL, new_vars = FALSE)

Arguments

data

A data frame.

data_recode

A correspondance table containing between character values and unordered level factors.

data_levels

An optional correpondance table between column names and ordered levels.

new_vars

If TRUE then it computes all variables referenced in data_recode, not only variables in data at the first place.

Value

A recoded data frame.


stephLH/source.maj documentation built on May 13, 2020, 1:54 p.m.