Using the Faraway package and stackloss data. We were asked to identify the outliers and remove them. The outlier was in row 21. This is the code I wrote to remove the outlier, but it is not working, saying that stack.loss2 needs to be a data frame. Any helps, or hints will be greatly appreciated. If I attached my code incorrectly, please let me know so that I can fix it.
stack.loss2 <- data.frame(stackloss)
stackloss1 <- data.frame(stackloss)
stack.loss2 <- stack.loss[1:20,]
stackloss1 <- stackloss[1:20,]
mod2<- lm(stack.loss2 ~ stackloss1)