[R] loglm() uses only a reference to data, and not data itself - is that on purpose??
Søren Højsgaard
Soren.Hojsgaard at agrsci.dk
Wed Oct 29 23:10:12 CET 2003
Dear all,
Consider the following:
library(MASS); data(HairEyeColor)
l1 <- loglm(~ 1+2+3, data=HairEyeColor)
myloglm <- function(){
nd <- HairEyeColor
v <- loglm(~ 1+2+3, data=nd)
return(v)
}
l2 <- myloglm()
Now, step(l1) works, whereas step(l2) does not, the problem being that data nd does not exist outside myloglm. I was under the impression that objects from functions like glm() and lm() "carried their data" with them, but that does not seem to be the case for loglm(). Is there a reason for these different behaviours??
Thanks in advance
Søren Højsgaard
More information about the R-help
mailing list