changeRefGroupDS {dsBase}R Documentation

Changes a reference level of a factor

Description

This function is similar to R function relevel,

Usage

changeRefGroupDS(xvect, ref = NULL, reorderByRef = NULL)

Arguments

xvect

a factor vector

ref

a character, the reference level

reorderByRef

a boolean that tells whether or not the new vector should be ordered by the reference group.

Details

In addition to what the R function does, this function allows for the user to re-order the vector, putting the reference group first. If the user chooses the re-order a warning is issued as this can introduce a mismatch of values if the vector is put back into a table that is not reordered in the same way. Such mismatch can render the results of operations on that table invalid.

Value

a factor of the same length as xvect

Author(s)

Isaeva, J., Gaye, A.


[Package dsBase version 6.3.0 ]