楼主:
Wush978 (拒看低质媒体)
2014-01-09 13:05:03[关键字]: R, string, sort
[重点摘要]:
今天踩到地雷了。
我写了一个script,在Rstudio和console下的行为却不同,经过一两天的debug才发现:
```r
a <- c(letters, LETTERS) # 英文的大小写字母
sort(a)
```
的结果会和系统环境有关!!
在sort的说明文件中有:
```
The sort order for character vectors will depend on the collating sequence of the locale in use: see Comparison. The sort order for factors is the order of their levels (which is particularly appropriate for ordered factors).
```
例如:http://rpubs.com/wush978/sorting
FYI
作者: clickhere (It's time to go home.) 2014-01-09 13:16:00
?Comparison的Details第二段才是解.因底层好像是qsort的样子,得自定比较法.