From tlumley at u.washington.edu  Sat Nov  6 18:04:45 2004
From: tlumley at u.washington.edu (Thomas Lumley)
Date: Sat Nov  6 18:05:01 2004
Subject: [Rd] foreign(read.spss) in rw2000 and re2001beta
In-Reply-To: <x24qk3dkh5.fsf@biostat.ku.dk>
References: <418CE35B.1000502@acelerate.com> <x24qk3dkh5.fsf@biostat.ku.dk>
Message-ID: <Pine.A41.4.61b.0411060900180.264288@homer07.u.washington.edu>

On Sat, 6 Nov 2004, Peter Dalgaard wrote:

> Kjetil Brinchmann Halvorsen <kjetil@acelerate.com> writes:
>
>> I made a test file test.sav with SPSS version 11.5.1
>> containing only one numeric variable, with a value label
>> for one value not occuring in the file. According to ?read.spss
>> this should result in a factor, but it results in all NA.
>

It should result in a factor all of whose values are missing. And it does.

I have modified read.spss (but not committed the changes yet)  so that it 
does not create a factor when there are missing levels.

The problem is that SPSS uses value labels for two different things: for 
factors and for labelling a subset of values (eg different types of 
missing). It is hard for R to guess which the user intends.

You can always set use.value.labels=FALSE.  You still get the value labels 
read in and then you can decide what to do with them.

 	-thomas


[Rd] foreign(read.spss) in rw2000 and re2001beta
Thomas Lumley