to_factor | R Documentation |
Convert a labelled vector to a factor, even if it doesn't have the proper
class, as long as it has the "labels" attribute.
You can have this attribute without, for example, the haven_labelled class,
when importing data with rio::import()
for example.
to_factor(x, ...)
x |
a vector |
... |
passed to |
example("labelled", "haven")
to_factor(x)
to_factor(zap_labelled(x))
to_factor(as_factor(x))
to_factor(1:4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.