Re: [R] Sorting of character vectors

2016-11-08 Thread Pascal A. Niklaus
Thanks for all suggestions. With my build (from the CRAN repo) I don't get ICU support, and setting LC_COLLATE to "C" did not help. > capabilities("ICU") ICU FALSE > sessionInfo() R version 3.3.2 (2016-10-31) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 14.04.5 LTS locale:

Re: [R] Sorting of character vectors

2016-11-08 Thread Rui Barradas
Hello, What is your sessionInfo()? With me it works as expected: > sort(c("-", "+")) [1] "-" "+" > sort(c("+", "-")) [1] "-" "+" > x5 <- c("+Aa","-Ab") > sort(x5) [1] "-Ab" "+Aa" > sessionInfo() R version 3.3.2 (2016-10-31) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64

Re: [R] Sorting of character vectors

2016-11-08 Thread peter dalgaard
On 08 Nov 2016, at 13:18 , Pascal A. Niklaus wrote: > I just got caught by the way in character vectors are sorted. > > It seems that on my machine "sort" (and related functions like "order") only > consider characters related to punctuation (at least here the "+"

[R] Sorting of character vectors

2016-11-08 Thread Pascal A. Niklaus
I just got caught by the way in character vectors are sorted. It seems that on my machine "sort" (and related functions like "order") only consider characters related to punctuation (at least here the "+" and "-") when there is no difference in the remaining characters: > x1 <- c("-A","+A")