Introduction
IBM® SPSS® Statistics provides the ability to create custom components in R that read the case data from the active data set, apply algorithms that are written in R to the data, and write the results back to IBM SPSS Statistics as a new data set or as pivot table or R graphic output directed to the Viewer, or exported via the Output Management System (OMS). You can analyze your data with an R function that you write or you can use a function from the extensive set of statistical routines available with R, all from within IBM SPSS Statistics.
With this technology you can:
- Create a custom IBM SPSS Statistics command (referred to as an extension command) that provides an interface to an R function from command syntax. The underlying R implementation code is hidden from the user, who only needs to know the command syntax for your command. See Creating Extension Commands for details.
- Create a custom dialog that generates and runs the command syntax for an extension command. Users only need to understand how to use the dialog to run the associated extension command, although the command syntax is available to them through the same Paste button mechanism as for built-in IBM SPSS Statistics dialog boxes. See Custom Dialogs for Extension Commands for details.
- Create a custom dialog that directly generates and runs R code without the use of an extension command. This approach is simpler to learn and use than working with extension commands, but is best suited for modest amounts of code. See Custom Dialogs for Generating Explicit R Code for details. Complex R programs are best implemented with extension commands, wrapped in custom dialogs.
R virtual runtime environment
Starting with IBM SPSS Statistics 28.0, an easily configurable R runtime virtual environment is included with the product installation. The runtime environment is configured for use with SPSS Statistics. You can enter R code directly in the runtime environment console.
- Windows
- macOS
- Windows
- C:\Users\<user_home>\AppData\Roaming\IBM\SPSS Statistics\one\R42
- macOS
- /Users/<user_name>/Library/Application Support/IBM/SPSS Statistics/one/R42