as_factor() converts a defined() vector into a standard R
factor. If value labels are present, they are turned into factor levels
via haven::as_factor(). Otherwise, the underlying values are converted
with base::factor().
Usage
as_factor(x, ...)
# S3 method for class 'haven_labelled_defined'
as_factor(x, strip_attributes = TRUE, ...)Arguments
- x
A vector created with
defined().- ...
Reserved for future extensions.
- strip_attributes
Logical; should semantic metadata attributes (such as
label,unit,definition, andnamespace) be removed from the returned vector? Defaults toTRUE.
