Assuming version 16 or later, you need to install the R plug-in from Developer Central. Then your R syntax can be run in the syntax window between
BEGIN PROGRAM R.
END PROGRAM R.
The output automatically appears in the SPSS Viewer with two cautions. 1) In version 16, R graphics are written to files and don't appear in the Viewer. Version 17 integrates the graphics directly. 2) When using R interactively, expression output appears in your console windows, e.g.,
displays the summary statistics for a data frame, dta. In non-interactive mode, which is what you are in when running BEGIN PROGRAM, you need to enclose the expression in a print function for it to display, e.g.,
The documentation for the apis to communicate between SPSS and R is installed along with the plug-in, and there are examples in the Data Management book linked on Developer Central (www.spss.com/devcentral).
You might also go through the PowerPoint article on Developer Central, "Programmability in SPSS Statistics 17", which you will find on the front page of the site. It includes a detailed example of using the R Quantreg package in SPSS as an extension command. There is also a download in the R section on creating an SPSS dialog box that generates an R program directly. Look for Rboxplot – Creating an R Program from a Dialog. This has a simple dialog box that generates code for an R boxplot along with an article that explains what is happening.
Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On
Behalf Of Eins Bernardo
Sent: Sunday, February 01, 2009 3:49 AM
Subject: [SPSSX-L] R in SPSS
Provided we have installed R, can we run R syntax in the "SPSS Syntax Editor" and then produce outputs in the "SPSS ourput viewer"?
Show off your style with new cool skins.
Try the all-new Yahoo! Messenger 9.0 today!