opts_factor {constructive} | R Documentation |
Constructive options for class 'factor'
Description
These options will be used on objects of class 'factor'.
Usage
opts_factor(
constructor = c("factor", "as_factor", "new_factor", "next", "integer"),
...
)
Arguments
constructor |
String. Name of the function used to construct the object, see Details section. |
... |
Additional options used by user defined constructors through the |
Details
Depending on constructor
, we construct the object as follows:
-
"factor"
(default): Build the object usingfactor()
, levels won't be defined explicitly if they are in alphabetical order (locale dependent!) -
"as_factor"
: Build the object usingforcats::as_factor()
whenever possible, i.e. when levels are defined in order of appearance in the vector. Otherwise falls back to"factor"
constructor. -
"new_factor"
: Build the object usingvctrs::new_factor()
. Levels are always defined explicitly. -
"next"
: Use the constructor for the next supported class. Call.class2()
on the object to see in which order the methods will be tried. -
"integer"
: We define as an integer vector and repair attributes.
Value
An object of class <constructive_options/constructive_options_factor>