r-lib / rray

Simple Arrays
https://rray.r-lib.org
GNU General Public License v3.0
130 stars 12 forks source link

`rray_min_pos()` returns wrong results if NA exists #244

Closed liuyadong closed 5 years ago

liuyadong commented 5 years ago
library(rray)
a <- c(NA, 1, 2, 3)

# rray_min and rray_max get correct results
rray_min(a)
#> [1] 1
rray_max(a)
#> [1] 3

# but rray_min_pos and rray_max_pos return wrong results
rray_min_pos(a)
#> [1] 1
rray_max_pos(a)
#> [1] 1

Created on 2019-07-30 by the reprex package (v0.3.0)

DavisVaughan commented 5 years ago

Yea the current behavior with reducing functions and NA values is not well defined. I tried to mention this in the README. It will get fixed in the next version after xtensor fixes a few upstream issues

https://github.com/r-lib/rray/#notes

DavisVaughan commented 5 years ago

I've cross linked to an existing meta issue for this, so I'm going to close this one