How data.table sorts strings when setting key

前端 未结 2 948
温柔的废话
温柔的废话 2021-01-11 19:03

Yesterday I had to spend some time trying to find a bug in my code and I found that data.table package sorts strings in a way a bit different from base. Is this

2条回答
  •  逝去的感伤
    2021-01-11 19:06

    Well, I am not sure what the most efficient way is but you can do the following to reproduce the data.frame result.

    dt[order(dt$cn)]
    
               cn
    1:     Ubuntu
    2:        USA
    3: Uzbekistan
    

提交回复
热议问题