Annotations, that is, objects of class
are character vectors with all their elements named.
Only one method is defined for this subclass of character vectors,
a method for
show, that shows the annotation in
a nicely formatted way. Annotations of an object can be obtained
via the function
annotation(x) and can be set via
Elements of an annotation with names
"wording" have a special meaning.
The first kind can be obtained and set via
the second kind can be obtained via
"description" elements are used in way the "variable labels"
are used in SPSS and Stata.
"wording" elements of annotation
objects are meant to contain the question wording of a questionnaire
item represented by an
These elements of annotations are treated in a special way
in the output of the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
annotation(x) ## S4 method for signature 'ANY' annotation(x) ## S4 method for signature 'item' annotation(x) ## S4 method for signature 'data.set' annotation(x) annotation(x)<-value ## S4 replacement method for signature 'ANY,character' annotation(x)<-value ## S4 replacement method for signature 'item,annotation' annotation(x)<-value ## S4 replacement method for signature 'vector,annotation' annotation(x)<-value description(x) description(x)<-value wording(x) wording(x)<-value ## S4 method for signature 'data.set' description(x) ## S4 method for signature 'importer' description(x)
a character or annotation object
annotation(x) returns an object of class
which is a named character.
wording(x) each usually return a character string.
description(x) is applied to a
data.set or an
however, a character vector is returned, which is named after the
variables in the data set or the external file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
vote <- sample(c(1,2,3,8,9,97,99),size=30,replace=TRUE) labels(vote) <- c(Conservatives = 1, Labour = 2, "Liberal Democrats" = 3, "Don't know" = 8, "Answer refused" = 9, "Not applicable" = 97, "Not asked in survey" = 99 ) missing.values(vote) <- c(97,99) description(vote) <- "Vote intention" wording(vote) <- "If a general election would take place next tuesday, the candidate of which party would you vote for?" annotation(vote) annotation(vote)["Remark"] <- "This is not a real questionnaire item, of course ..." codebook(vote)