spss_to_r: Master SPSS to R function

Description Usage Arguments Details

View source: R/SPSStoR.r

Description

This function inputs SPSS syntax and returns comparable R syntax.

Usage

1
2
spss_to_r(file, dplyr = TRUE, writeRscript = FALSE, filePath = NULL,
  nosave = FALSE)

Arguments

file

Path of text file that has SPSS syntax

dplyr

A value of TRUE uses dplyr syntax (default), a value of FALSE uses data.table syntax

writeRscript

TRUE or FALSE variable to write R script. By default this is FALSE.

filePath

Path to save R script. Default is NULL which saves to working directory as 'rScript.r'.

nosave

A value of FALSE processes the save commands (default), a value of TRUE continues processing within R, overriding default x object. Extreme care with this feature as get commands will be ignored.

Details

The only required input for this function is a text file that contains SPSS syntax. The SPSS syntax can be the .sps syntax file that SPSS saves as or can be copied into another text file format. The function readLines is used to read in the file line by line.

A single column matrix is used to return the R code. If a R command is long it does not wrap the code and so copy and pasting may be needed. As an alternative, the R syntax can be saved to an R script file. No column names or row names are printed when saving this script file.


lebebr01/SPSStoR documentation built on Nov. 21, 2019, 9:45 p.m.