SPSS Statistics

SPSS Statistics

Your hub for statistical analysis, data management, and data documentation. Connect, learn, and share with your peers! 

 View Only
  • 1.  how to open a dataset using the R extension on SPSS??

    Posted Fri January 05, 2024 01:20 PM

    Hi, grad student here, not much skilled with R. I was taught how to use SPSS, but my supervisor uses R so he sent me the syntax for our research analysis in R-code and I tried to run it on SPSS (version 27) using the R extension (version 3.6) (Windows user here), but it's not working and I don't know why.

    I tried opening the file using R language but nothing shows up on the dataset page, and no error appears on the output page either, just the command followed by a "- /", and I have no idea what it means. So I tried opening the dataset using normal SPSS coding, and it works, but then I used another R command (copied and pasted from the file my professor sent me, so it should work) to convert a string variable in a numeric one, but again the output page just shows the command with no error mentioned while nothing happens on the dataset. Any idea why???

    Again, I am absolutely clueless as to what I should expect, I have never used the R extension on SPSS, and I only tried this time because R is totally foreign to me and have no idea how to use it.
    Can anyone help? Thanks!



    ------------------------------
    G S
    ------------------------------


  • 2.  RE: how to open a dataset using the R extension on SPSS??

    Posted Fri January 05, 2024 01:33 PM

    Hi @G S

    It sounds like you will need to develop some facility with the R programming language as well as with IBM SPSS Statistics.

    May I suggest the documentation specific to what you want to do?

    For instance, you asked about how to open an SPSS Statistics data set (*.sav) from R.  If your intent is to remain with Statistics in control and have Statistics 'drive' your R installation, please see this page, and specifically the spssdata.GetDataFromSPSS function.

    I hope this helps!



    ------------------------------
    David Dwyer
    SPSS Technical Support
    IBM Software
    ------------------------------



  • 3.  RE: how to open a dataset using the R extension on SPSS??

    Posted Fri January 05, 2024 01:41 PM
    There's more going on here than can be quickly explained, but running a block of R code in SPSS between BEGIN PROGRAM R. and END PROGRAM (don't forget the periods after these SPSS commands).will not affect anything in SPSS except that printed output in the R code will appear in the SPSS Viewer.  You would need to have code that creates an SPSS dataset from the R data frame that you have presumably created.

    If the R code is self contained and doesn't use any SPSS functions, then you should just run it in Rgui or R Studio or some other R IDE.  If it does use some SPSS commands, we would need to know more to help.

    --