Sort.int function incorrectly sorts vectors under certain conditions
StevenMayher opened this issue · 1 comments
Describe the bug
The Sort.int function exhibits peculiar behavior when sorting vectors - in particular, if the vector contains a single 1 value and no 0 value, instead of returning the properly sorted vector, it returns the sorted vector with the 1 value dropped, and a 0 appended to the end of the vector.
To Reproduce
library(Rfast)
a = c(1L, 3L, 2L, 5L, 4L)
Rfast::Sort.int(a)
[1] 2 3 4 5 0
Expected behavior
base::sort.int(a)
[1] 1 2 3 4 5
Desktop:
sessionInfo()
R version 4.3.3 (2024-02-29 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8 LC_MONETARY=English_United States.utf8 LC_NUMERIC=C
[5] LC_TIME=English_United States.utf8
time zone: America/New_York
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] Rfast_2.1.0 RcppParallel_5.1.7 RcppZiggurat_0.1.6 Rcpp_1.0.12
loaded via a namespace (and not attached):
[1] digest_0.6.34 fastmap_1.1.1 xfun_0.41 knitr_1.45 parallel_4.3.3 htmltools_0.5.7 rmarkdown_2.25 cli_3.6.2 compiler_4.3.3
[10] rstudioapi_0.15.0 tools_4.3.3 evaluate_0.23 yaml_2.3.8 rlang_1.1.3
There is already an open issue.