Skip to content

Still a bug with NA in sd() or var()?

1 message · Tony Plate

#
Roger Dungan wrote:
What you are doing here looks very odd to me -- you are passing a vector 
of logicals as the value for the argument na.rm.  This is odd because 
na.rm should be just a single logical value, not a vector of the same 
length as x (hence the warning message).  Only the first element of that 
vector is used, so you are passing essentially a random value.  By luck, 
in your example, the first element was T, which is why you got a value 
of 1.707825 as the result, and not NA.  The rest might fall into place 
when this understanding is cleared up.

-- Tony Plate