Description Usage Arguments Note Author(s) Examples
When reading SPSS files with read_data, the output contains vectors
of class labelled. This function extracts the labels and attaches them
as an attribute (by the same name) to the data, and converts any labelled
variables into factors.
| 1 2 3 4 5 6 7 | from_labelled(x)
## S3 method for class 'labelled'
from_labelled(x)
## S3 method for class 'data.frame'
from_labelled(x)
 | 
| x | A  | 
data.table input returns a copy of the data.table.
Kristian D. Olsen
| 1 2 3 4 5 6 7 8 | vals <- c("Agree", "Neutral", "Disagree", "Don't know")
var <- haven::labelled(c(1, 5), labels = setNames(1:4, vals))
# Works with just the labelled vector
from_labelled(var)
# And a data.frame containing labelled vectors
from_labelled(as.data.frame(var))$var
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.