[R] min(NA,"bla") != min("bla", NA)
Rolf Turner
rolf.turner at xtra.co.nz
Thu Sep 26 23:32:23 CEST 2013
Just to add to the confusion, on my system I get NA --- which I
understand to be
the correct value --- from all of min(NA,"bla"), min("bla",NA),
min(c(NA,"bla")), and
min(c("bla",NA)). When I append the argument na.rm=TRUE to each of the
calls,
I get "bla" from each.
So, no bug in my system.
> sessionInfo()
> R version 3.0.1 (2013-05-16)
> Platform: x86_64-unknown-linux-gnu (64-bit)
>
> locale:
> [1] C
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
>
> other attached packages:
> [1] misc_0.0-15
>
> loaded via a namespace (and not attached):
> [1] tools_3.0.1
Are the rest of youse guys using Windoze? No wonder ....
cheers,
Rolf
On 09/27/13 05:55, Duncan Murdoch wrote:
> 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"
>
> This should be all fixed now (at least for min and max; it's possible
> some of the other summary functions still have oddities). It's in
> R-devel, soon r-patched. All of the above examples should now give a
> character NA.
>
> Duncan Murdoch
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list