[R] is.null() and lm obj

vito muggeo vito.muggeo at giustizia.it
Tue Feb 11 15:26:03 CET 2003


Dear all,
I found the following strange behavior of is.null() in the x component of a
lm object.
*However note that I'm running R-1.5.1, so probably the error (if someone)
has been fixed in the the versions 1.6.x. If it is so, please apologizes for
this my e-mail

x<-1:10
y<-rnorm(10)
obj<-lm(y~x)
>is.null(obj$y)
[1] TRUE
>is.null(obj$x)
[1] FALSE
>dim(obj$x)
NULL

That is, according to "is.null(obj$x)" the design matrix seems to be present
in the lm object, but it is not so, of course. "is.null(obj$y)" seems to
work correctly.

best,
vito




More information about the R-help mailing list