View source: R/labelled_spss_survey.R
labelled_spss_survey | R Documentation |
This class is amending haven::labelled_spss
with a unique object
identifier id
to make later binding or joining
reproducible and well-documented.
labelled_spss_survey(
x = double(),
labels = NULL,
na_values = NULL,
na_range = NULL,
label = NULL,
id = NULL,
name_orig = NULL
)
as_character(x)
## S3 method for class 'retroharmonize_labelled_spss_survey'
levels(x)
## S3 replacement method for class 'retroharmonize_labelled_spss_survey'
names(x) <- value
## S3 method for class 'retroharmonize_labelled_spss_survey'
format(x, ..., digits = getOption("digits"))
is.labelled_spss_survey(x)
## S3 method for class 'retroharmonize_labelled_spss_survey'
median(x, na.rm = TRUE, ...)
## S3 method for class 'retroharmonize_labelled_spss_survey'
quantile(x, probs, ...)
## S3 method for class 'retroharmonize_labelled_spss_survey'
weighted.mean(x, w, ...)
## S3 method for class 'retroharmonize_labelled_spss_survey'
mean(x, ...)
## S3 method for class 'retroharmonize_labelled_spss_survey'
sum(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()
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.