Description Usage Arguments Value Author(s) Examples
Factor variables with numbers as levels are alphabetically ordered by default, which requires rearrangements for various purposes, e.g. modelling or visualizations. This function re-orders levels of numeric factor variables numerically.
1 | refactorNum(x, decreasing = FALSE)
|
x |
A factor variable with numeric values as levels |
decreasing |
Logical, should the levels sorted descendingly? |
A factor variable, with sorted numeric values as levels
Jitao David Zhang <jitao_david.zhang@roche.com>
1 2 | (nums <- factor(c("2","4","24","1","2","125","1","2","125")))
(nums.new <- refactorNum(nums))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.