Learn R Programming

translateSPSS2R (version 1.0.0)

xpssValueLabels: Modifies value labels

Description

R implementation of the SPSS VALUE LABEL function. xpssValueLabels creates value labels for specific variables. The values of the label get stored in attributes of the variable.

Usage

xpssValueLabels(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 names of the variables.
values
atomic numeric or numeric vector containing the values of the variable.
labels
atomic character or character vector containing the variable labels.
datevariables
atomic date or date vector with the names of the date variables.
datevalues
atomic date or date vector containing the value of the date, the values has to be like the old date format.
datelabels
atomic character or character vector containing the date labels.

Details

The SPSS variables are stored at the variable itself. In contrast to xpssAddValueLabels , xpssValueLabels does erase existing value labels. If the value label for a specific variable already exists, all value labels for that variable get overwritten. If the value label for a specific variable does not exist, the value label gets created and all existing value labels for that variable get deleted. A variable can have the following attributes: value.labels, defined.MIS, MIS, varname, variable.label

See Also

xpssAddValueLabels xpssVariableLabels

Examples

Run this code
data(fromXPSS)

temp <- xpssValueLabels(fromXPSS,
                           variables = "V1",
                           value = 1 ,
                           label = "Label1")

fromXPSS <- xpssAddValueLabels(fromXPSS,
                           variables = "V1",
                           values = c("A","B"),
                           labels = c("Label1","Label2"))

Run the code above in your browser using DataLab