Chuck Cleland
2008-Jul-29 08:49 UTC
[R] Problem reading a particular file with read.spss()
Hi All: I have a seemingly typical SPSS data file with 219 rows and 486 variables. When I attempt to read this file into R with read.spss() in the foreign package, I consistently get a "crash". This is the sequence of events: > library(foreign) > sessionInfo() R version 2.7.1 Patched (2008-07-24 r46120) i386-pc-mingw32 locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] foreign_0.8-27 > read.spss("c:/chuck/mySPSSfile.sav") "R for Windows GUI front-end has encountered a problem and needs to close. We are sorry for the inconvenience." It get a similar result trying to load the file under Rterm.exe. The file opens without any trouble in SPSS version 16.0.2 (April 10, 2008). For anyone willing to investigate, I placed a copy of the SPSS file here: http://www.chuckcleland.net/mySPSSfile.sav I would be grateful if someone could help to figure out why this file causes a problem. thanks, Chuck -- Chuck Cleland, Ph.D. NDRI, Inc. (www.ndri.org) 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 512-0171 (M, W, F) fax: (917) 438-0894
Prof Brian Ripley
2008-Jul-29 10:19 UTC
[R] Problem reading a particular file with read.spss()
It works for me, on Windows with that version of foreign. I also tried under Linux with valgrind, and nothing untoward was reported. The warnings are Warning messages: 1: In read.spss("mySPSSfile.sav") : mySPSSfile.sav: File-indicated character representation code (1252) looks like a Windows codepage 2: In read.spss("mySPSSfile.sav") : mySPSSfile.sav: Unrecognized record type 7, subtype 18 encountered in system file The first is innocuous for you (given your locale), and the second indicated that there is info that we don't know about (SPSS 16.x is not common). On Tue, 29 Jul 2008, Chuck Cleland wrote:> Hi All: > I have a seemingly typical SPSS data file with 219 rows and 486 variables. > When I attempt to read this file into R with read.spss() in the foreign > package, I consistently get a "crash". This is the sequence of events: > >> library(foreign) >> sessionInfo() > R version 2.7.1 Patched (2008-07-24 r46120) > i386-pc-mingw32 > > locale: > LC_COLLATE=English_United States.1252;LC_CTYPE=English_United > States.1252;LC_MONETARY=English_United > States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > other attached packages: > [1] foreign_0.8-27 > >> read.spss("c:/chuck/mySPSSfile.sav") > > "R for Windows GUI front-end has encountered a problem and needs to close. > We are sorry for the inconvenience." > > It get a similar result trying to load the file under Rterm.exe. The file > opens without any trouble in SPSS version 16.0.2 (April 10, 2008). For > anyone willing to investigate, I placed a copy of the SPSS file here: > > http://www.chuckcleland.net/mySPSSfile.sav > > I would be grateful if someone could help to figure out why this file > causes a problem. > > thanks, > > Chuck > > -- > Chuck Cleland, Ph.D. > NDRI, Inc. (www.ndri.org) > 71 West 23rd Street, 8th floor > New York, NY 10010 > tel: (212) 845-4495 (Tu, Th) > tel: (732) 512-0171 (M, W, F) > fax: (917) 438-0894 > > ______________________________________________ > R-help at r-project.org 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. >-- 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
Maybe Matching Threads
- Memisc package: imported varibles from SPSS have got wrong measurement
- Reading spss files into R - warnings
- importing explicitly declared missing values in read.spss (foreign)
- read.spss question warning compression bias
- re ad.spss (foreign) conflict with SPSS 17 files.