xpssAddValueLabels: Modifies value labels

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/xpssAddValueLabels.R

Description

R implementation of the SPSS ADD VALUE LABELS function. xpssAddValueLabels appends value labels for specific variables. Those values labels get stored in the attributes of the selected variable.

Usage

1
2
xpssAddValueLabels(x, variables = NULL, values = NULL, labels = NULL,
  datevariables = NULL, datevalues = NULL, datelabels = NULL)

Arguments

x

a (non-empty) data.frame or input data of class "xpssFrame".

variables

atomic character or character vector with the name of the variables.

values

atomic numeric or numeric vector, respectively as an atomic character or character vector containing the value of the variable.

labels

atomic numeric or numeric vector, respectively as an atomic character or character vector containing the label of the variable.

datevariables

atomic date or date vector with the name of the date variables.

datevalues

atomic date or date vector containing the value of the date, the value has to be like the old date format.

datelabels

atomic numeric or numeric vector, respectively as an atomic character or character vector containing a variable label.

Details

The values labels are stored in the variable itself.
In contrast to xpssValueLabels , xpssAddValueLabels do not erase existing value labels.
If the value label for a specific variable already exists, this value label get overwritten.
If the value label for a specific variable does not exist, the value label get created without deleting the existing value label of that variable.

Supported attributes are: value.labels, defined.MIS, MIS, varname, variable.label

Value

An xpssFrame object with modified value labels.

Author(s)

Bastian Wiessner

See Also

read.spss xpssValueLabels xpssVariableLabels

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
data(fromXPSS)

fromXPSS <- xpssValueLabels(fromXPSS,
                           variables = "V1",
                           values = 1 ,
                           labels = "Label1")

fromXPSS <- xpssAddValueLabels(fromXPSS,
                           variables = "V1",
                           values = 2 ,
                           labels = "Label2")

fromXPSS <- xpssAddValueLabels(fromXPSS,
                           variables = "V1",
                           values = "B" ,
                           labels = "CharLabel")



attributes(fromXPSS$V1)$value.labels

translateSPSS2R documentation built on May 30, 2017, 4:31 a.m.