[R] read.spss, locale and encodings
Peter Dalgaard
p.dalgaard at biostat.ku.dk
Wed Apr 8 19:12:23 CEST 2009
Hans Ekbrand wrote:
> On Wed, Apr 08, 2009 at 04:17:51PM +0200, Peter Dalgaard wrote:
>> Hans Ekbrand wrote:
>>> Someone running foreign 8.34 that is willing to test my SPSS-file?
>> Someone with an SPSS file problem willing to help test the prereleases? :-)
>
> http://sociologi.cjb.net/temp/test.sav
No joy.
> read.spss("~/Desktop/downloads/test.sav", reencode = "latin1")
Error in read.spss("~/Desktop/downloads/test.sav", reencode = "latin1") :
error reading system-file header
In addition: Warning message:
In read.spss("~/Desktop/downloads/test.sav", reencode = "latin1") :
~/Desktop/downloads/test.sav: position 143: Variable name begins with
invalid character
(I suppose the actual culprit could be number 144 which does indeed
start with an A-ring ("ÅLDKAT"))
Apparently, you can work around it like this
lc <- Sys.setlocale("LC_CTYPE")
Sys.setlocale("LC_CTYPE", "da_DK")
x <- read.spss("~/Desktop/downloads/test.sav", reencode = "latin1")
Sys.setlocale("LC_CTYPE", lc)
-- which doesn't strike me as particularly logical, but whatever works....
--
O__ ---- Peter Dalgaard Øster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list