[R] min(NA,"bla") != min("bla", NA)
Duncan Murdoch
murdoch.duncan at gmail.com
Thu Sep 26 18:45:54 CEST 2013
On 26/09/2013 11:07 AM, Magnus Thor Torfason wrote:
> Just ran these two statements:
>
> > min(NA,"bla")
> [1] NA
>
> > min("bla", NA)
> [1] "bla"
>
> And then reran with explicit na.rm=FALSE
>
> > min(NA,"bla", na.rm=FALSE)
> [1] NA
>
> > min("bla", NA, na.rm=FALSE)
> [1] "bla"
>
>
> That seems wrong. Would this be considered a bug or is there a way to
> explain these results in a different way?
I'd call it a bug. The internal code does a lot of tricky things with
NA values and type coercion, and it looks as though this particular
combination got messed up. I wonder if there are other cases, too?
I'll take a look.
Duncan Murdoch
More information about the R-help
mailing list