Error in lm.fit (x, y, offset = offset, singular.ok = singular.ok ,…): no (non Na) cases available

Maybe you didn’t report this mistake because of the same problem. I hope this blog can help those students who made the same mistake as me

When I was writing data analysis and R software job, I always reported the error of “no (non-NA) case available” when I was executing the following code. No matter how I looked at it, I always felt that my code was perfectly written. Why?Finally, it turned out that the data.exercise4.2.sav I had quoted was having a problem and the corresponding independent variable X2 in the data file had forgotten to enter the values!!

> library(foreign)
> x<-read.spss("data.exercise4.2.sav",to.data.frame=TRUE)
> lm.1<-lm(Y~X1+X2,data=x)
> summary(lm.1)

Solution: open the.SAV file in SPSS, and add the value of the independent variable X2.


Read More: