[Rd] some SPSS 15 files wont open in R 2.4.0

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Apr 5 19:31:47 CEST 2007

On Thu, 5 Apr 2007, Sam Smith wrote:

> Trying to open some SPSS .sav files (saved with SPSS 15) gives the following:
> 	read.spss('/data/big/unzipped_ukda/seh3767/3767SPSS_570D6A086C9A1B0636F13255F25A58C1/prgrp95.sav')
> 	Error in
> read.spss("/data/big/unzipped_ukda/seh3767/3767SPSS_570D6A086C9A1B0636F13255F25A58C1/prgrp95.sav"):
> error reading system-file header
> 	In addition: Warning message:
> 	/data/big/unzipped_ukda/seh3767/3767SPSS_570D6A086C9A1B0636F13255F25A58C1/prgrp95.sav:
> 	File-indicated character representation code (Unknown) is not ASCII
> Some are fine in R, some are not.

This is not 'in R', it is in contributed (recommended) package 'foreign', 
so it is that's version that is relevant here. (We do ask for 
sessionInfo() in the R posting guide for good reason.)

> The file opens in SPSS, and googling the error message gives
> this mail about PSPP
>         http://www.nabble.com/problem-loading-SPSS-15.0-save-files-t2726500.html
> which includes a diff for the PSPP code which opens R files
> and throws that exact error message back.

'R files'?  Surely, 'SPSS 15 files'!

That just removes a test.  If Ben Pfaff thinks it is no longer needed, I 
suppose we could just remove it, but what happens if SPSS has Latin-1 or 
UTF-8 data?  I think we should give a warning if not an error.

> R documentation says that it uses some code based on PSPP,
> I can't see it in the R distribution?.

Look in the tarball for foreign (in src/library/Recommended).

> Does anyone with more
> clue than I know whether the above is likely to fix it, and
> where I should be looking for the code to change?
> Alternatively, has anyone got any ideas on opening these files?

Use SPSS and re-save in an open format?

Brian D. Ripley,                  ripley at 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

More information about the R-devel mailing list