m <- mean(x, na.rm = TRUE)
It should rather be as follows to properly pass on the parameter na.rm: m <- mean(x, na.rm = na.rm)
m <- mean(x, na.rm = TRUE)
It should rather be as follows to properly pass on the parameter na.rm: m <- mean(x, na.rm = na.rm)