First thing we will do is show the first few entries in the mtcars dataset
head(mtcars[c("mpg","cyl","disp")])
## mpg cyl disp
## Mazda RX4 21.0 6 160
## Mazda RX4 Wag 21.0 6 160
## Datsun 710 22.8 4 108
## Hornet 4 Drive 21.4 6 258
## Hornet Sportabout 18.7 8 360
## Valiant 18.1 6 225
Now we fit a regression model
m1 <- lm(mpg ~ cyl + disp, data=mtcars)
Think it is safe to email this to people without DUAs? Think again
head(m1$model)
## mpg cyl disp
## Mazda RX4 21.0 6 160
## Mazda RX4 Wag 21.0 6 160
## Datsun 710 22.8 4 108
## Hornet 4 Drive 21.4 6 258
## Hornet Sportabout 18.7 8 360
## Valiant 18.1 6 225
Now we can call lm with model=FALSE option.
m2 <- lm(mpg ~ cyl + disp, data=mtcars, model=FALSE)
Try printing data now
head(m2$model)
## NULL