You are not logged in.

#1 2010-12-20 10:48:11

Hantabaru
Member
Registered: 2009-02-25
Posts: 58

Importing SPSS .sav files into R

Hi

I realise this is a bit of a niche question but a search of the forums showed there are a at least some R uses out there and I need a question answering:

I want to import some old data from before my move to linux into R. I have them saved as SPSS .sav files and don't have (or want smile ) access to SPSS.

I read on http://www.statmethods.net/input/importingdata.html that you can import it with the following:

# save SPSS dataset in trasport format
get file='c:\mydata.sav'.
export outfile='c:\mydata.por'. 

# in R 
library(Hmisc)
mydata <- spss.get("c:/mydata.por", use.value.labels=TRUE)
# last option converts value labels to R factors

I have the Hmisc library installed but it seems from this I have to convert the .sav file to .por in SPSS before I can import it to R.

Is there anyone that can shine some light on this and, if this is the case, give an alternative method to achieve the same goal?

Any help much appreciated smile

Offline

#2 2010-12-20 11:00:30

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,399
Website

Re: Importing SPSS .sav files into R

I use something like:

library("foreign")
read.spss("file")

Offline

#3 2010-12-20 11:41:28

Hantabaru
Member
Registered: 2009-02-25
Posts: 58

Re: Importing SPSS .sav files into R

That seems to be what I am looking for.

I will have read about it in the help and try it out.

Thanks smile

Offline

#4 2010-12-25 15:14:00

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: Importing SPSS .sav files into R

Moved to Workstation User.


ᶘ ᵒᴥᵒᶅ

Offline

Board footer

Powered by FluxBB