I try to understand the difference between using different na.actions (na.omit and na.exclude) to handle missing data in a linear model using R. I used the lm function in R (https://stat.ethz.ch/R-manual/R-devel/library/stats/html/lm.html).

The summary of my linear model prints exactly the same for na.omit and na.exclude. But if I look at the residuals, the na.exclude gives me NA' s for the cases where there was an NA and it gives me a list of residuals without NA for the na.omit.


 1       2       3       4    5       6       7       8            
-0.0526 -0.0930 -0.3295  NA  -0.1520 -0.3217 -0.3220  0.0722  


 1       2       3            5       6       7      8            
-0.0526 -0.0930 -0.3295      -0.1520 -0.3217 -0.3220  0.0722 

I now would like to understand, which option should be preferred in a linear model and how this affects my statistics.. unfortunately, I only could find tutorials explaining that these different options exist, but no advice on what to choose. https://stats.idre.ucla.edu/r/faq/how-does-r-handle-missing-values/

  • 3
    $\begingroup$ Based on this link, it appears that from estimation point of view both are equivalent as they remove the row where any of the dependent or independent variable is missing. Only benefit of na.exclude is that it retains the position where data was missing in the final residual vector. If that is something you want then that makes na.exclude preferable over na.omit. $\endgroup$
    – Dayne
    Oct 21, 2020 at 7:02

1 Answer 1


The only benefit of na.exclude over na.omit is that the former will retain the original number of rows in the data. This may be useful where you need to retain the original size of the dataset - for example it is useful when you want to compare predicted values to original values. With na.omit you will end up with fewer rows so you won't as easily be able to compare.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.