[R] Problems with na.rm=T

Duncan Murdoch murdoch at stats.uwo.ca
Thu Jun 14 17:01:04 CEST 2007


On 6/14/2007 10:32 AM, Lucke, Joseph F wrote:
> Suddenly (e.g. yesterday) all my functions that have "na.rm=" as a
> parameter (e.g., mean(), sd(), range(), etc.) have been reporting
> warnings with "na.rm=T". The message is "Warning message: the condition
> has length > 1 and only the first element will be used in: if (na.rm) x
> <- x[!is.na(x)] ".   This has never happened before.  I don't recall
> having done anything that might generate this message.  How do I fix
> this?

I imagine you have created a variable T of length greater than 1.  Use 
TRUE (which is a reserved word, so you can't create such a variable). 
Don't keep big workspaces full of stuff you don't know about, create a 
new empty one in each session.

Duncan Murdoch



More information about the R-help mailing list