[R] importing spss-files [ was: "Re: need your consult"]

Hans Ekbrand hans at sociologi.cjb.net
Tue Aug 9 14:22:54 CEST 2011


On Tue, Aug 09, 2011 at 02:28:22AM -0700, Mehrshad Koleini wrote:
> Dear Sir/Madam
> 
> 
> Hi. I am a general paediatrician, and I have read *some* chapters of the
> following books(1-3). I think SPSS lacks some features that may be important
> in data analysis (for example: interval of correlation coefficient in
> bivariate normal distribution, PRESS, and MSPR in cross-validation). I am
> thinking about changing SPSS to R:
> 
> 
>    1.    SPSS is very expensive for me to update.
>    2.  My colleagues use SPSS, but I think data can be exchanged between
>    SPSS, and R, is this true?

Yes, but the data must be converted, which it not an entirely seamless
process, there might be quirks to be handled manually.

To import data from an SPSS file to R, read
http://cran.r-project.org/doc/manuals/R-data.html and
http://cran.r-project.org/web/packages/foreign/foreign.pdf

Basically, it can be as simple as

library(foreign)
foo <- read.spss(file = "data_set.sav")

now, your data is in object "foo", which can be inspected with the
function str()

str(foo)

--
Hans Ekbrand
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110809/fd7f2a9f/attachment.bin>


More information about the R-help mailing list