RcmdrMisc (version 1.0-6)

readSPSS: Read an SPSS Data Set

Description

readSPSS reads an SPSS data set, stored in a file of type .sav or .por, into an R data frame; it provides a front end to the read_spss function in the haven package and the read.spss function in the foreign package.

Usage

readSPSS(file, rownames=FALSE, stringsAsFactors=default.stringsAsFactors(),
  tolower=TRUE, use.haven=!por)

Arguments

file

path to an SPSS .sav or .por file.

rownames

if TRUE (the default is FALSE), the first column in the data set contains row names, which should be unique.

stringsAsFactors

if TRUE then columns containing character data are converted to factors and factors are created from SPSS value labels; the default is taken from default.stringsAsFactors().

tolower

change variable names to lowercase, default TRUE.

use.haven

use read_spss from the haven package to read the file, in preference to read.spss from the foreign package; the default is TRUE for a .sav file and FALSE for a .por file.

Value

a data frame

See Also

read_spss, read.spss