varlabels | R Documentation |
In a surveydata object, the variable.labels
attribute store metadata about the original question text (see foreign::read.spss()
for details). The function varlabels()
returns the variable.labels
attribute of data, and varlabels(x) <- value
updates this attribute.
varlabels(x) varlabels(x) <- value
x |
surveydata object |
value |
New value |
In a surveydata object, the varlabels
attribute is a named character vector, where the names correspond to the names of the the columns in
surveydata-package
Other Attribute functions:
pattern()
Other Attribute functions:
pattern()
# Extract the variable labels from membersurvey ms <- membersurvey[, c("id", "Q1", "Q2")] str(ms) varlabels(ms) varlabels(ms)["Q2"] # Assign a new value to the text of question 2 varlabels(ms)["Q2"] <- "When did you join?" varlabels(ms) str(ms["Q2"])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.