spss.get {Hmisc}R Documentation

Enhanced Importing of SPSS Files

Description

spss.get invokes the read.spss function in the foreign package to read an SPSS file, with a default output format of "data.frame". The label function is used to attach labels to individual variables instead of to the data frame as done by read.spss. By default, integer-valued variables are converted to a storage mode of integer unless force.single=FALSE. Date variables are converted to R POSIXct variables (or S-Plus chron variables if splusdates=TRUE).

Usage

spss.get(file, datevars = NULL, use.value.labels = TRUE, to.data.frame =
TRUE, max.value.labels = Inf, typeDate = c('POSIX','chron'), force.single=TRUE)

Arguments

file input SPSS save file
datevars vector of variable names containing dates to be converted to R or S-Plus internal format
use.value.labels see read.spss
to.data.frame see read.spss; default is TRUE for spss.get
max.value.labels see read.spss
typeDate set to "chron" to convert variables in datevars to chron objects (suitable for S-Plus) instead of the default of "POSIX"
force.single set to FALSE to prevent integer-valued variables from being converted from storage mode double to integer

Value

a data frame or list

Author(s)

Frank Harrell

See Also

read.spss,cleanup.import,sas.get

Examples

## Don't run: 
w <- spss.get('/tmp/my.sav', datevars=c('birthdate','deathdate'),
              typeDate='chron')
# Create a file S-Plus can read
dump('w', '/tmp/w')ds
# To read into S-Plus 6 do:
# library(Hmisc,T); source('/tmp/w'); w <- cleanup.import(w)
  
## End Don't run

[Package Contents]