Skip to content

Instantly share code, notes, and snippets.

@lindemann09
Created January 7, 2016 14:16
Show Gist options
  • Save lindemann09/0c50a2925458140dcbae to your computer and use it in GitHub Desktop.
Save lindemann09/0c50a2925458140dcbae to your computer and use it in GitHub Desktop.
Convert SPSS data (.sav) to comma-separated text (.csv)
#!/usr/bin/Rscript
#
# Converts spss file to csv-file ("output.csv")
#
# usage:
# Rscript spss2csv.R <FILENAME>
library(foreign)
args <- commandArgs(trailingOnly = TRUE)
data = read.spss(args[1], to.data.frame=TRUE)
str(data)
write.csv(data, file="output.csv", row.names=F)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment