Is there an R library package that defaults the na.rm argument in the basic descriptive statistics (mean, sd, etc.) to TRUE? I want to have the option to set na.rm=FALSE
, but I do not want this to be the default.
It is similar to Is it possible to set na.rm to TRUE globally? , but this has become dated and incomplete. And, perhaps most importantly, it does not have a solution for sd, var, etc.
It's even trickier than that. The following works EXCEPT it cannot be stuck into an .Rprofile file (where it states Error: object 'var' not found
)
orig.var <- var
var <- function(x, ..., na.rm = TRUE) { orig.var(x, ..., na.rm = na.rm) }