[R] Bug? Index output of C functions R_qsort_I and R_qsort_int_I is not modified
ee224 @end|ng |rom b@th@@c@uk
Thu Apr 15 14:33:24 CEST 2021
Reading the documentation of these two functions
"The ..._I() versions also return the sort.index() vector in I."
I can't find anything in the documentation about sort.index(), but I'm guessing that I is the index that makes the input sorted, as in R's order(). However running the following code on
R version 4.0.5 (2021-03-31) Platform: x86_64-pc-linux-gnu (64-bit)
does not give me that. It just gives me the original input.
Rlib = file.path(Sys.getenv("R_HOME"), "lib", paste0("libR", .Platform$dynlib.ext))
n = 4L
ix = n:1
i = integer(n)
cc = .C("R_qsort_int_I", ix, i, 1L, n)
I expect 4 3 2 1, but I get 0 0 0 0. Is this a bug or have I misunderstood something?
[[alternative HTML version deleted]]
More information about the R-help