Description Usage Arguments Details See Also Examples
View source: R/labelled_spss_survey.R
This class is amending haven::labelled_spss
with a unique object
identifier id
to make later binding or joining
reproducible and well-documented.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | labelled_spss_survey(
x = double(),
labels = NULL,
na_values = NULL,
na_range = NULL,
label = NULL,
id = NULL,
name_orig = NULL
)
as_character(x)
is.labelled_spss_survey(x)
as_numeric(x)
|
x |
A vector to label. Must be either numeric (integer or double) or character. |
labels |
A named vector or |
na_values |
A vector of values that should also be considered as missing. |
na_range |
A numeric vector of length two giving the (inclusive) extents
of the range. Use |
label |
A short, human-readable description of the vector. |
id |
Survey ID |
name_orig |
The original name of the variable. If left |
It inherits many methods from labelled, but uses more strict coercion and validation rules.
as_factor
Other type conversion functions:
as_labelled_spss_survey()
Other type conversion functions:
as_labelled_spss_survey()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | x1 <- labelled_spss_survey(
1:10, c(Good = 1, Bad = 8),
na_values = c(9, 10),
id = "survey1")
is.na(x1)
# Print data and metadata
print(x1)
x2 <- labelled_spss_survey( 1:10,
labels = c(Good = 1, Bad = 8),
na_range = c(9, Inf),
label = "Quality rating",
id = "survey1")
is.na(x2)
# Print data and metadata
x2
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.