Re: [R] read.spss (package foreign) and SPSS 15.0 files

From: John Kane <jrkrideau_at_yahoo.ca>
Date: Fri 06 Apr 2007 - 11:31:45 GMT

> On Thu, 5 Apr 2007, Michael Conklin wrote:
>
> > Not being the developer I cannot answer
> definitively but, as a frequent
> > user of SPSS files I can give you my experience.
> >
> > 1) The unrecognized coding is perhaps due to the
> locale of the SPSS
> > installation. I have had success reading in files
> from version 15 but
> > often encounter that error when the file was
> created with data that
> > included some foreign language. I often receive
> survey files that were
> > administered in a non-English language and that is
> when I usually see
> > the error.
>
> That is what is surmised in this recent R-devel
> thread:
>
>
https://stat.ethz.ch/pipermail/r-devel/2007-April/045238.html
>
> although it may also happen in an English locale
> (since after all Windows
> uses codepage 1252, not ASCII, for American
> 'English').
>
> The next release of package foreign will give a
> warning (rather than an
> error) with an unrecognized encoding and recognize a
> few more.
>
> > 2) My experience with the "Warning - unrecognized
> record type" message
> > is that it has no effect whatsoever on the data
> file.
> >
> > 3) Others on the list have noted that you are
> safer exporting POR files
> > instead of SAV files from SPSS. Both are read by
> the read.spss function.
>
> The R Data Import/Export manual recommends an open

> format such as .csv.
> (Look like John Kane has yet to read it ....)

Well, as I mentioned, I've been using a tab delimited approach. I suppose I could move to .csv...
>R
> does have quite extensive
> facilities for dealing with encodings in text files.
>
> >
> > Hope that helps.
> >
> >
> >
> > Michael Conklin
> > Chief Methodologist - Advanced Analytics
> > MarketTools, Inc.
> >
> >
> > -----Original Message-----
> > From: r-help-bounces@stat.math.ethz.ch
> [mailto:r-help-bounces@stat.math.ethz.ch] On Behalf
> Of John Kane
> > Sent: Thursday, April 05, 2007 7:45 PM
> > To: RINNER Heinrich; r-help@stat.math.ethz.ch
> > Subject: Re: [R] read.spss (package foreign) and
> SPSS 15.0 files
> >
> >
> > --- RINNER Heinrich <HEINRICH.RINNER@tirol.gv.at>
> > wrote:
> >
> >> Hello,
> >>
> >> does anyone have experience with reading SPSS
> >> Version 15.0 files into R (version 2.4.1, WinXP)?
> >>
> >> I have long been sucessfully reading SPSS files
> with
> >> read.spss from the wonderful foreign package, but
> >> somehow after upgrading from SPSS14 to SPSS15 I
> seem
> >> to have problems.
> >>
> >> Trying a simple example, where test.sav is a SPSS
> >> 15.0 data file consisting of x1=c(1,2,3) and
> >> x2=c("a","b","c"), I get this:
> >>> read.spss(file = "C:\\temp\\test.sav")
> >> Fehler in read.spss(file = "C:\\temp\\test.sav")
> :
> >> error reading system-file header
> >> Zusätzlich: Warning message:
> >> C:\temp\test.sav: File-indicated character
> >> representation code (Unknown) is not ASCII
> >>
> >> version infos:
> >> R version 2.4.1 (under WinXP)
> >> foreign version 0.8-18
> >>
> >> Has anyone experienced the same, and can give a
> >> solution here (possibly other than "downgrade to
> >> SPSS14.0" ;-))?
> >>
> >> Regards,
> >> Heinrich.
> >
> > Heck. I'd be happy to get an answer to what is
> > happening here:
> >> mac <- spss.get("H:/ONTH/Raw.data/Follow.sav")
> > Warning message:
> > H:/ONTH/Raw.data/Follow.sav: Unrecognized record
> type
> > 7, subtype 16 encountered in system file
> >
> > I have taken to exporting the file to a delimited
> > format and reading it into R since I cannot trust
> the
> > R import.
>
>
> --
> Brian D. Ripley,
> ripley@stats.ox.ac.uk
> Professor of Applied Statistics,
> http://www.stats.ox.ac.uk/~ripley/
> University of Oxford, Tel: +44 1865
> 272861 (self)
> 1 South Parks Road, +44 1865
> 272866 (PA)
> Oxford OX1 3TG, UK Fax: +44 1865
272595



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sat Apr 07 01:02:36 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 06 Apr 2007 - 16:30:58 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.