Skip to content
Prev 163992 / 398503 Next

How to force aggregate to exclude NA ?

How to use the na.rm function outside aggregate ? I tried 
 
na.rm <- function(f) {
  function(x, ...) f(x[!is.na(x)], ...)
}
function(x, ...) f(x[!is.na(x)], ...)
Error in na.rm(sum, c(NA, 1, 2)) : unused argument(s) (c(NA, 1, 2))