sum(..., na.rm=TRUE) oddity
rohan sadler wrote:
Okay, This is one of the cases where I can answer my own foolishness. If I don't define the switch as na.rm=TRUE, but instead just as TRUE - which is my usual practice with other functions - then sum counts the TRUE as another vector object, and counts it as one. So much for saving keystrokes.
Are you certain you typed 'na.rm'? I have occasionally typed 'rm.na' instead, and something like that might explain things: > sum(1,1,na.rm=TRUE) [1] 2 > sum(1,1,rm.na=TRUE) [1] 3 Baz