Description Usage Arguments Value Examples
reFactor will refactor a categorical variable such that the order of the levels have changed (e.g change what the reference group will be)
1 |
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 |
Refactored vector
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"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.