[Rd] read.spss converts string variables with value labels to <NA> (PR#9896)

From: <honza_at_ifolk.cz>
Date: Mon, 03 Sep 2007 12:46:56 +0200 (CEST)

Full_Name: Jan Hucin
Version: 2.5.1 (foreign 0.8-20)
Submission from: (NULL) (

When reading an SPSS file:

I have always get <NA> where digits were in the original SPSS file.

Let's have in an SPSS file "some.sav" the variable A. The type of the variable is String of length 1.
Let's have a value labeling: 1 = Yes, 2 = No, 8 = Invalid, 9 = Missing. Let's determine that value 9 is considered to be missing.
When this file is read by abc=read.spss("some.sav",use.value.labels=TRUE), we get <NA> in abc$A on places where "1", "2" etc. were. Surprisingly, we get "N/A" (not <NA>!) on the place where the string "N/A" is.

If we specify use.value.labels=FALSE, then we get string values (such as "1", "2") but we lose value labels (Yes, No etc.).

Let me add that if the variable in the original SPSS file was of type Numeric (not String), there would be no problem.

R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Mon 03 Sep 2007 - 13:23:55 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 05 Sep 2007 - 18:41:22 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.