[R] Still missing something on missing values...

Matej Cepl matej at ceplovi.cz
Sat Oct 26 23:24:26 CEST 2002


Hi,

I have a SPSS datafile which is used for my textbook in the
statistics (and which is available on
http://abacon.com/fox/s6720p2.sav, but it is originally from
ICPSR).

When I opened it with SPSS 10 and run Frequencies on it I 
have got 979 valid data a 27 missing. However, see below 
(unfortunately, I have used R in preparation of my homework, 
which caused me an error on this):

	> data=read.spss("s6720p2.sav")
	> levels(data$CP1)
	[1] "Rf"      "Dk"      "Neither" "Oppose"  "Favor"
	> length(data$CP1[data$CP1=="Favor"])
	[1] 727
	> length(data$CP1[data$CP1=="Oppose"])
	[1] 177
	> length(data$CP1[data$CP1=="Neither"])
	[1] 79
	> length(data$CP1[data$CP1=="Dk"])
	[1] 19
	> length(data$CP1[data$CP1=="Rf"])
	[1] 3
	> data$CP1[data$CP1=="Rf" | data$CP1=="Dk"]<-NA
	> length(data$CP1[!is.na(data$CP1)])
	[1] 983
	> length(data$CP1[is.na(data$CP1)])
	[1] 22
	> 727+177+79
	[1] 983

Now, what is even more strange is, that when I have exported just 
the variable CP1 from the full file (in SPSS) and run on it the 
same frequencies as in the full size version, the results were 
same as in R (yes, I have checked that the definition of the 
missing values was the same: 8,9 -- labelled as Rf and Dk).

I have uploaded the data and all reports (in PDF) on 
http://www.volny.cz/cepls/ps-pdf/s6720p2.zip.

Could anybody help me to understand what I did wrong, please?

	Thanks
	
		Matej

-- 
Matej Cepl, matej at ceplovi.cz, PGP ID# D96484AC
138 Highland Ave. #10, Somerville, Ma 02143, (617) 623-1488
 
In those days spirits were brave, the stakes were high, men were
real men, women were real women and small furry creatures from
Alpha Centauri were real small furry creatures from Alpha
Centauri.
    -- Douglas Adams

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list