SPSStoR

R package to convert SPSS syntax to R code

62
24
R

SPSS to R

Build Status
codecov.io

A set of functions that takes SPSS syntax as input and outputs R commands
to do the same analysis or data management tasks.

Current Features

  • Read in Data
    • Get for sav files
    • Get for csv, txt, xls, xlsx files with get data.
  • Data Manipulation
    • Sort Cases
  • Descriptives
    • Aggregate
    • Correlations
    • Crosstab
    • Descriptives
    • Frequencies
    • Graphics
  • Models
    • One sample t-test
    • Independent sample t-test
    • One-way ANOVA - with oneway routine

Upcoming Features

  • More Get commands to read in csv, txt, etc.
  • Dataset commands
  • Value Labels
  • Further arguments for descriptives
  • Modeling functions
    • t-test (two sample with cut score and paired)
    • analysis of variance - more complicated designs
    • regression
    • generalized models
  • if else statements
  • Examine

Installing Function

devtools::install_github("lebebr01/SPSStoR")
library(SPSStoR)

Examples

Multiple commands

# Multiple commands in one
spss_to_r(system.file("SPSSsyntax", "getDescExamp.txt", package = "SPSStoR"))

Aggregate Example

  spss_to_r(system.file("SPSSsyntax", "aggregateExamp.txt", package = "SPSStoR"))

Correlation Example

  spss_to_r(system.file("SPSSsyntax", "correlationsExamp.txt", package = "SPSStoR"))

Crosstab Example

  spss_to_r(system.file("SPSSsyntax", "crosstabExamp.txt", package = "SPSStoR"))

Sort Cases Example

  spss_to_r(system.file("SPSSsyntax", "sortCasesExamp.txt", package = "SPSStoR"))

Descriptives Example

  spss_to_r(system.file("SPSSsyntax", "descriptivesExamp.txt", package = "SPSStoR"))

t-test Examples

# t-test one-sample
  spss_to_r(system.file("SPSSsyntax", "ttestOneSampExamp.txt", package = "SPSStoR"))
# Independent t-test example
  spss_to_r(system.file("SPSSsyntax", "ttestTwoSampValExamp.txt", package = "SPSStoR"))
  

Get Command Example

  spss_to_r(system.file("SPSSsyntax", "getExamp.txt", package = "SPSStoR"))

Graphics

  spss_to_r(system.file("SPSSsyntax", "graphExamps.txt", package = "SPSStoR"))

Frequencies

  spss_to_r(system.file("SPSSsyntax", "frequenciesExamp.txt", package = "SPSStoR"))