[Rd] read.spss() cannot import some SPSS files (PR#9074)

tim.bock at numbers.net.au tim.bock at numbers.net.au
Wed Jul 12 07:52:35 CEST 2006


Full_Name: Tim Bock
Version: 2.3.1
OS: Windows XP
Submission from: (NULL) (220.233.111.181)


SPSS v12 on Windows sometimes writes files with a layout_code of 3 instead of
the usual layout_code of 2.  While I don't know what this signifies, R is able
to read these files if I change sfm-read.c to accept 3.

Also, R issues an unnecessary warning when it finds records of type 7 with
sub-type 7.  These records describe multiple-response sets, which can safely be
ignored.

Here are my suggested changes, based on the foreign_0.8-15.tar.gz.  (I'd be
happy to commit these via svn, but I assume that this is not allowed for
non-core developers.)

413a414
>               case 7: /* Multiple-response sets (later versions of 
SPSS). */
580a582
>   R_int32 orig_layout_code;
651c653
<   if (hdr.layout_code == 2)
---
>   if (hdr.layout_code == 2 || hdr.layout_code == 3)
654a657
>       orig_layout_code = hdr.layout_code;
656,658c659,661
<       if (hdr.layout_code != 2)
<       lose ((_("%s: File layout code has unexpected value %d.  Value 
should be 2, in big-endian or little-endian format"),
<              h->fn, hdr.layout_code));
---
>       if (hdr.layout_code != 2 && hdr.layout_code != 3)
>       lose ((_("%s: File layout code has unexpected value %d (or %d, 
endian-reversed).  Value should be 2 or 3, in big-endian or little-endian
format"),
>              h->fn, orig_layout_code, hdr.layout_code));



More information about the R-devel mailing list