Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

spss.get

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 Date variables. By default, underscores in names are converted to periods.

Usage

spss.get(file, lowernames=FALSE, datevars = NULL,
         use.value.labels = TRUE, to.data.frame = TRUE,
         max.value.labels = Inf, force.single=TRUE,
         allow=NULL, charfactor=FALSE, reencode = NA)

Arguments

file

input SPSS save file. May be a file on the WWW, indicated by file starting with 'http://' or 'https://'.

lowernames

set to TRUE to convert variable names to lower case

datevars

vector of variable names containing dates to be converted to R 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

force.single

set to FALSE to prevent integer-valued variables from being converted from storage mode double to integer

allow

a vector of characters allowed by R that should not be converted to periods in variable names. By default, underscores in variable names are converted to periods as with R before version 1.9.

charfactor

set to TRUE to change character variables to factors if they have fewer than n/2 unique values. Blanks and null strings are converted to NAs.

reencode

see read.spss

Value

a data frame or list

Author(s)

Frank Harrell

See Also

Examples

## Not run: 
w <- spss.get('/tmp/my.sav', datevars=c('birthdate','deathdate'))
  
## End(Not run)

Hmisc

Harrell Miscellaneous

v4.5-0
GPL (>= 2)
Authors
Frank E Harrell Jr <fh@fharrell.com>, with contributions from Charles Dupont and many others.
Initial release
2021-02-27

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.