[R] read.spss doesn't work anymore [more info]

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Mon Aug 11 19:49:09 CEST 2003


Hedderik van Rijn <hedderik at cmu.edu> writes:

> Some more information about my read.spss issues: on a cleanly
> installed Debian Woody machine:
> 
> ~/TMP % R
> 
> R : Copyright 2003, The R Development Core Team
> Version 1.7.1  (2003-06-16)
> 
> [...]
> 
>  > library(foreign); x <- read.spss("dataDef.sav")
> Error in read.spss("dataDef.sav") : Calloc could not allocate
> (-2147483648 of 1) memory
>  > x <- read.spss("dataDef.sav")
>  > x <- read.spss("dataDef.sav")
> Segmentation fault
> 
> However, using R Version 1.7.0  (2003-04-16) installed using Fink on
> Mac OS X, the .sav file reads without a problem.
> 
> The .sav file has in its header the following reference:
> 
> SPSS DATA FILE SPSS for Unix Release 6.1 (HP9000 700 )
> 
> Although for the moment I'm reading in a Mac OS X R save'd version of
> the SPSS data file, I would like to read in the original .sav file.
> Does anyone know what the problem might be? The .sav file can be
> downloaded from:
> 
>    http://viropage.psy.cmu.edu/~rijn/dataDef.sav.bz2  (approx 100 kb)


Thanks. I've debugged a little, and it seems that the primary reason
is that a bogus value is read for n_lines in read_documents (file
sfm_read.c). 

Once this has failed, the code paints itself into a corner by checking
whether the file was already open in sfm_read_dictionary; this test
succeeds, but the content of the dict structure remains bogus... I
can't reproduce your segfault, but as I said, this phenomenon is
probably secondary to the real problem anyway.

The value that is getting read for n_lines is 134217728 aka 0x8000000
which looks like it could be intended as a special value?

> On Sunday, Aug 10, 2003, at 17:15 US/Eastern, Hedderik van Rijn wrote:
> 
> > A couple of months ago, probably using an older version of R, R used
> > to run the following code just fine:
> >
> >  library("foreign")
> >  data.exp1 <- as.data.frame(read.spss("dataDef.sav"))
> >
> > Issuing the same commands now (after starting R using --vanilla),
> > gives me the following behavior:
> >
> > > library("foreign")
> > > x <- read.spss("dataDef.sav")
> > Error in read.spss("dataDef.sav") : Calloc could not allocate
> > (-2147483648 of 1) memory
> > > x <- read.spss("dataDef.sav")
> > > x <- read.spss("dataDef.sav")
> > Segmentation fault
> >
> > The first two assignments return instantaneously, after the second x
> > contains all original SPSS variable/column names but no data, after
> > the last read.spss - it takes a while before R returns with the
> > Segmentation fault. During that time, the harddisk seems to be
> > working quite hard.
> >
> > Does anyone know what the problem might be?
> >
> >  - Hedderik.
> >
> > > version
> >          _
> > platform i386-pc-linux-gnu
> > arch     i386
> > os       linux-gnu
> > system   i386, linux-gnu
> > status
> > major    1
> > minor    7.1
> > year     2003
> > month    06
> > day      16
> > language R
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> >
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list