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

Thomas Lumley tlumley at u.washington.edu
Sat Nov 6 18:04:45 CET 2004


On Sat, 6 Nov 2004, Peter Dalgaard wrote:

> Kjetil Brinchmann Halvorsen <kjetil at 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



More information about the R-devel mailing list