Relevels a factor so that the selected category becomes the reference
(first) level. By default, the reference level is chosen as the level with
the largest total weight, for example the largest exposure in an insurance
portfolio. Use method = "manual" with reference_level when a specific
business category should be the reference level.
Arguments
- x
A factor (unordered). Character vectors should be converted to factor before use.
- weight
A numeric vector of the same length as
x, typically representing exposure or frequency weights. Required whenmethod = "largest_weight".- method
Character. Method used to choose the reference level. Supported methods are
"largest_weight"and"manual".- reference_level
Character string with the level to use as reference when
method = "manual".
References
Kaas, Rob & Goovaerts, Marc & Dhaene, Jan & Denuit, Michel. (2008). Modern Actuarial Risk Theory: Using R. doi:10.1007/978-3-540-70998-5.
