convertLabel: Transform SPSS variable and value labels.

convertLabelR Documentation

Transform SPSS variable and value labels.

Description

By default, read.spss from the foreign package uses variable labels as attributes of the whole data.frame, value labels as attribute of each specific variable in the data.frame. convertLabel provides variable and value labels as variable attributes.

Usage

convertLabel(spssList, stringsAsFactors = TRUE, useZkdConvention = TRUE)

Arguments

spssList

An object created by read.spss. Important: Using read.spss, to.data.frame has to be FALSE.

stringsAsFactors

Transform character variables into factors?

useZkdConvention

Logical: If TRUE. variable labels are named 'varLabel', value labels are named 'valLabel'.

Value

A data.frame.

Author(s)

Sebastian Weirich

Examples

file <- system.file("extdata", "Klauer.sav", package = "eatAnalysis")
dat  <- foreign::read.spss(file, to.data.frame=FALSE, use.value.labels = FALSE)
dat  <- convertLabel(dat)
str(dat)

beckerbenj/eatAnalysis documentation built on July 7, 2023, 5:51 p.m.