Description Usage Arguments Note Author(s) Examples
Reverses the process from from_labelled
, by attempting to create
labelled variables in place of factor
, and adding labels
to each variable.
1 2 3 4 5 6 7 | to_labelled(x, label = NULL)
## S3 method for class 'factor'
to_labelled(x, label = NULL)
## S3 method for class 'data.frame'
to_labelled(x, ...)
|
x |
A |
label |
Optional: Set a label when converting a vector to |
... |
Ignored.
|
Because of a limitation in ReadStat (it can't write strings longer
than 256 characters), write_data
will write the long strings as
a separate .Rdata file. If you use read_data
, you will get them back.
Kristian D. Olsen
1 2 3 4 5 6 7 8 | levs <- c("Agree", "Neutral", "Disagree", "Don't know")
var <- factor(levs[c(1, 3, 4)], levels = levs)
# Works with just the factor
to_labelled(var)
# And a data.frame containing labelled vectors
to_labelled(as.data.frame(var))$var
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.