Last week, we released the new versions of SPSS Statistics (version 24) and SPSS Modeler (version 18). With the new product release we also have a new version of R Essentials available for both products. R has been integrated with SPSS Statistics since version 19 and Modeler since version 16. This integration allows for the creation of extensions, which are custom dialogs that allow you to use a GUI to execute R code in Statistics or Modeler. In the releases this week, a new feature for both products is the ability to download and install extensions from within the product. I am happy to announce that R Essentials can now be downloaded directly from GitHub.
Click here to find your version of R Essentials for SPSS StatisticsClick here to find your version of R Essentials for SPSS Modeler
Now I will walk through the installation of R Essentials for SPSS Modeler 18 and SPSS Statistics 24.
Install Guide for SPSS Modeler v18:Previously, I wrote
this blog post, which gives details on installing R Essentials in SPSS Modeler. I've included steps below for installing R Essentials for version 18 of Modeler with a couple extra tips.
- Install the correct version of R. For Modeler version 18 you will need to have R version 3.2.x installed on your machine. I downloaded this version here.
- Download and run R essentials from the Modeler R Essentials GitHub repository.
- When installing R Essentials, there are two file paths you will need to validate:
- First, you need to indicate your R installation folder. My installer defaulted to R-3.2.1 but I have R-3.2.2 installed, so I needed to change it. If you try using an older version of R you will get an error message (I tried).
- Next, you need to pick the right bin folder for your installation. This will be different based on where you installed Modeler. The installer defaults to the "ModelerServer" directory, but if you are not using Modeler Server this needs to be changed to the "Modeler" directory. The screen shot below shows the path that I used that was successful.
- If everything was successful you should see this screen:
- Now we have R installed and R Essentials installed. To do a quick test, let's open up Modeler 18
- Add a User input node to the canvas and type something like 'a' into the Field and a number '1' in Values. This is dummy data just so we can run quick R code, if you already have a Source node on your canvas you can use that
- From the Record Ops palette, add a R Transform node and type the following:
print('hello modeler!')
Not too exciting, but enough for now.
- Now right click on this node and select preview. This will show a table of your input data, but what we care about is the Console Output in the R Transform node. It should look like this:
If you produced the same output as shown in the screenshot then you have successfully installed R Essentials for Modeler!
Install Guide for SPSS Statistics v24:
- Install the correct version of R. For Statistics version 24 you will need to have R version 3.2.x installed on your machine. I downloaded this version here.
- Download and run R essentials from the Statistics R Essentials GitHub repository.
- When installing R Essentials, there are two file paths you will need to validate:
- First, you need to indicate your R 3.2.x installation folder. This will look slightly different than the Modeler screenshot above but is the same step.
- Next, you need to pick the installation folder for your Statistics version 24. I used the default install path so I did not have to change anything here. If you changed your install directory you will need to update this.
- Next, you just need to confirm both directories you selected were correct and click Install.
- Now we have R installed and R Essentials installed. To do a quick test, let's open up Statistics 24
- Open SPSS Statistics and create a new Syntax Editor by clicking File > New > Syntax
- Let's type in some basic syntax for starting an R program and printing a statement
BEGIN PROGRAM R
print('Hello Statistics')
END PROGRAM
- Now highlight this code block or click the 'BEGIN PROGRAM' on the left pane of the Syntax editor and click the green 'Run Selection' button at the top of the screen. This will create a new Output window displaying your code and the R output:
You now have R Essentials installed for version 24 of SPSS Statistics!
If using version 24 of SPSS Statistics or version 18 of Modeler - go to Extensions > Extension Hub to find & install extensions that will help make your work easier. If you are on an older version, visit
the Predictive Analytics Gallery on GitHub to find extensions.
#Programmability#R#SPSS#SPSSModeler#SPSSStatistics