SPSS25 and R Code script problems

Purchased the new book Andy Field’s Discovering Statistics Using SPSS 5th Edition – just came out and has new items from previous editions. One of the big additions he has is the use of R within SPSS. In one of the early chapters he has s
specific command to download a new R module to be accessed inside of SPSS.
Here’s the code he provides.

BEGIN PROGRAM R.

install.packages(“WRS2″)

END PROGRAM.

When I ran it nothing seemed to happen. So I went looking for an answer and came across this:
https://www.ibm.com/developerworks/library/ba-call-r-spss/index.html
I copied the code for displaying “Hello R!”

BEGIN PROGRAM R.

cat(“ttHello R!n”)

END PROGRAM.

When I ran it this is what I got back;

Warning messages:
1: In doTryCatch(return(expr), name, parentenv, handler) :
unable to load shared object ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/modules//R_X11.so’:
dlopen(/Library/Frameworks/R.framework/Versions/3.3/Resources/modules//R_X11.so, 6): Library not loaded: /opt/X11/lib/libSM.6.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.3/Resources/modules//R_X11.so
Reason: image not found
2: In redirection() : Unable to open connection to X11 display.
Hello R!

Note that the file R_X11.so is in that folder. Also note that for some reason there is a double forward slash…

Thanks

Related:

Leave a Reply