Import a SPSS database into a Rsocialdata database.

Share:

Description

The get.spss.file is the standard function to import a SPSS database (in a .sav file) into a Rsocialdata database. The function is based on the read.spss function. The read.spss function is run two times to get both coding and labels of both variables and values. The measure of each imported variable (categorical or scale) is automatically detected. If a variable has all its values (valid cases and missing values) labelised, the variable will be set as a categorical variable. If a variable has at least one of its values (valid cases or missing values) with no label, the variable will be set as a scale variable.

Usage

1
2
3
4
5
get.spss.file(file, datadir, variables = NULL, tsvar = character(0),
  ovar = character(0), wvar = character(0),
  use.coding.order = "increasing", max.value.labels = Inf,
  savingName = NULL, lowernames = TRUE, name = NULL,
  description = character(0), exportPDF = TRUE, reencode = "latin1")

Arguments

file

the full name of the file you want to import

datadir

the directory where your SPSS file is. If missing the working directory is used.

variables

the list of variables you want to import. If missing all variables in the SPSS file are imported.

tsvar

a vector containing the names of variables having to be converted in the TimestampVariable type. The SPSS timestamp origin "1582-10-14" is used to set the origin of the time variable.

ovar

a vector containing the names of variables having to be converted in the OrdinalVariable type.

wvar

a vector containing the names of variables having to be converted in the WeightingVariable type.

use.coding.order

a character, either "increasing", "decreasing", "default". If "increasing" the coding order is used to sort the order in the values of the Variable. If "decreasing" the order is in a decreasing way. If "default" no sorting is performed. Default is "increasing".

max.value.labels

depreciated. Will be soon removed.

savingName

a character. By setting this argument you produce an export in .Rdata of the SPSS file with the name given.

lowernames

a logical. If TRUE all names are set in lower case.

name

a character. The name of the data base. If NULL the name of the file is used.

description

a character. A description of the database.

exportPDF

a logical. If TRUE the summary in PDF of the data base is created.

reencode

a logical: should character strings be re-encoded to the current locale. Default is TRUE. Alternatively character, specifying an encoding to assume.

Value

a Rsocialdata-class object.