ripley at stats.ox.ac.uk
2007-Sep-04 13:50 UTC
[Rd] (PR#9896) read.spss converts string variables with value
There is nothing we can do to reproduce this without an example 'some.sav' file exhibiting the problem. Can you please supply one? On Mon, 3 Sep 2007, honza at ifolk.cz wrote:> Full_Name: Jan Hucin > Version: 2.5.1 (foreign 0.8-20) > OS: WinXP > Submission from: (NULL) (195.113.83.7) > > > When reading an SPSS file: > > - containing some variable of type String > - with value labels at that variable > - and with determination which values of that variable are considered to be > missing, > > I have always get <NA> where digits were in the original SPSS file. > > Example: > 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 >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595