factor_swap: For swapping out one factor for another.

Description Usage Arguments Value

View source: R/functions.R

Description

For swapping out one factor for another (e.g. numerical code to actual sentences in response).

Usage

1
2
factor_swap(df, columns, original_factors = NA, new_factors = NA,
  addNA = NULL)

Arguments

df

dataframe, dataframe with factors being swapped.

columns

vector, identifies columns containing factors to swap.

original_factors

vector, gives factors to swap.

new_factors

vector, gives replacements for original_factors.

addNA

logical or string, if not NULL, replaces NAs with string.

Value

A dataframe like df, but with original_factors in columns replaced by new_factors (and NAs replaced with addNA if addNA used).


IskanderBlue/morseldash documentation built on Oct. 30, 2019, 7:24 p.m.