
## generate some data
n <- 50
x <- runif(n)
a0 <- 10
a1 <- .5
sigma.e <- 1
y <- a0 + a1*x + rnorm(n)*sigma.e
tmp.d <- data.frame(y, x)
rm(list=c("n", "x", "a0", "a1", "sigma.e", "y"))

print(lm.1 <- lm(y ~ poly(x, 2), data = tmp.d)

## now make a few NA's

tmp.d$x[1:2] <- rep(NA, 2)

## this fails, just as it should
print(lm.1 <- lm(y ~ poly(x, 2), data = tmp.d))

## these also fail, but should not?

print(lm.2 <- lm(y ~ poly(x, 2), data = tmp.d, subset = !is.na(x)))
print(lm.3 <- lm(y ~ poly(x, 2), data = tmp.d, na.action = na.omit))

## but this does not

print(lm.3 <- lm(y ~ poly(x, 2), data = subset(tmp.d, subset = !is.na(x))))

