Skip to content

Instantly share code, notes, and snippets.

@mjrich
Last active December 26, 2015 03:49
Show Gist options
  • Save mjrich/7088424 to your computer and use it in GitHub Desktop.
Save mjrich/7088424 to your computer and use it in GitHub Desktop.
script for opening SPSS data (from Afrobarometer) in R
library(foreign)
library(memisc)
library(Hmisc)
setwd("C:\\your\\working\\folder")
#Open with standard foreign package
data_frame_attempt1 <- read.spss("yourdata.sav")
#Open with memisc package HT http://stackoverflow.com/questions/3136293/read-spss-file-into-r
data_frame_attempt2 <- data.frame(as.data.set(spss.system.file("yourdata.sav")))
#Open with Hmisc package
data_frame_attempt3 = spss.get("yourdata.sav")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment