reFactor: reFactor

Description Usage Arguments Value Examples

Description

reFactor will refactor a categorical variable such that the order of the levels have changed (e.g change what the reference group will be)

Usage

1
reFactor(x, order_index = NULL, order_levels = NULL)

Arguments

x

Vector to be refactored

order_index

Index of the current factor levels in which to refactor with

order_levels

Actual Vector levels to use to refactor with

Value

Refactored vector

Examples

1
2
3
4
5
6
7
8
#v <- sample(letters[1:3], 10, replace = T)
#factor(v)
#Reverse order
#reFactor(v)
#refactor based on original factor index
#reFactor(v, order_index = c(2, 1, 3))
#refactor based on actual levels
#reFactor(v, order_levels = c("b", "a", "c"))

TaylorAndrew/atClean documentation built on May 9, 2019, 4:21 p.m.