I have a general question. is there anyway that I can identify (or tag) the observations used in a regression in R?
lligator = data.frame(lnLength = c(3.87, 3.61, NA, 3.43, 3.81, 3.83, 3.46, 3.76,
3.50, 3.58, 4.19, 3.78, 3.71, 3.73, 3.78),lnWeight = c(4.87, 3.93, 6.46, 3.33, 4.38, 4.70, 3.50, 4.50,NA, 3.64, 5.90, 4.43, 4.38, 4.42, 4.25))
t.test=lm(lnWeight ~ lnLength, data = alligator)
I want to create a data frame with another column indicating which observation is used. I know how
na.omit()
and
na.exclude()
and
.completecases
work and I can use them to do the regression. but what I am looking for is a way to create an indicator to show which observation is used. for those of Stata users something similar to e(sample)