[R-SIG-Mac] Reading SPSS data

Mark Heckmann mark.heckmann at gmx.de
Thu Nov 26 18:47:55 CET 2009


Hi

I have some issues loading an SPSS file using foreign package on Mac  
OS (snow leopard and R 2.10.0).
The main problem is that either the file is not read due to encoding  
or the german umlauts are not displayed properly.

As far as I know SPSS encodes on Windows machines in latin-1 and CRLF  
(carriage return, line feed) (actually I do not know if this is  
important for this)
but I heard that the unix standard is LF only. AFIK.
So whatever coding I choose for the reencode argument in read.spss  
(e.g. "ISO-...") does not work out .The file is not read.

Could someone give me a detailed explanation what is happening and how  
to solve this?
I saw a couple of problems concerning reading SPSS files on Mac OS on  
R-help but none of the advices worked out.

I get the following messages (partialy translated from german R output)

 > mydata <- read.spss("./data.sav",use.value.labels = TRUE,  
to.data.frame = TRUE)
Error in make.names(vnames, unique = TRUE) :
   ungültige multibyte string 4

 > mydata <- read.spss("./data.sav",use.value.labels = TRUE,   
to.data.frame = TRUE, reencode="ISO-8859-1")	
Recoding from ISO-8859-1
Error in if (tp %in% "none") next : Argument has length 0

 > mydata <- read.spss("./data.sav",use.value.labels = TRUE,   
to.data.frame = TRUE, reencode="UTF-8")	
Recoding from  UTF-8
Error in if (tp %in% "none") next : Argument has length 0

I am not at all familiar with encodings and so on, so I would really  
appreciate a rookie type of explanation...

TIA
Mark


–––––––––––––––––––––––––––––––––––––––
Mark Heckmann
Dipl. Wirt.-Ing. cand. Psych.
Vorstraße 93 B01
28359 Bremen
Blog: www.markheckmann.de
R-Blog: http://ryouready.wordpress.com



More information about the R-SIG-Mac mailing list