varlabels: Returns and updates variable.labels attribute of surveydata...

Description Usage Arguments Details See Also Examples

Description

In a surveydata object, the variable.labels attribute store metadata about the original question text (see read.spss for details). The function varlabels returns the variable.labels attribute of data, and varlabels(x) <- value updates this attribute.

Usage

1
2
3
  varlabels(x)

  "varlabels(x) <- value"

Arguments

x

surveydata object

value

New value

Details

In a surveydata object, the varlabels attribute is a named character vector, where the names correspond to the names of the the columns in

See Also

surveydata-package

Other Attribute functions: pattern, pattern<-

Other Attribute functions: pattern, pattern<-

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# 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"])


Search within the surveydata package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.