[R] sort order of a character sequence is different on windose and linux (linux result)
Duncan Murdoch
murdoch.duncan at gmail.com
Sun Jul 6 13:06:47 CEST 2014
On 06/07/2014, 6:30 AM, Witold E Wolski wrote:
> This is the result of sorting a character sequence on a linux box
> (with R . 3.10)
See ?sort. The sort order depends on your locale. Set it to "C" for
consistent ordering if that is important to you. For example, on my system:
> "B" < "a"
[1] FALSE
> Sys.setlocale("LC_COLLATE", "C")
[1] "C"
> "B" < "a"
[1] TRUE
(but see the warning in the example in ?locales).
Duncan Murdoch
>
>> bla = read.table("xx.txt",stringsAsFactors=F)
>> bla = bla[,1]
>> bla[1:10]
> [1] "1000_DGFVALSK_2_run0" "1000_DGFVALSK_2_run0"
> "1000_DGFVALSK_2_run0" "1000_DGFVALSK_2_run0"
> "1000_DGFVALSK_2_run0"
> [6] "1000_DGFVALSK_2_run0" "1001_DGGAWGTEQR_2_run0"
> "1001_DGGAWGTEQR_2_run0" "1001_DGGAWGTEQR_2_run0"
> "1001_DGGAWGTEQR_2_run0"
>> sort(bla)[1:10]
> [1] "1000_DGFVALSK_2_run0" "1000_DGFVALSK_2_run0"
> "1000_DGFVALSK_2_run0" "1000_DGFVALSK_2_run0"
> "1000_DGFVALSK_2_run0"
> [6] "1000_DGFVALSK_2_run0" "1001_DGGAWGTEQR_2_run0"
> "1001_DGGAWGTEQR_2_run0" "1001_DGGAWGTEQR_2_run0"
> "1001_DGGAWGTEQR_2_run0"
>>
>
> I will send the result of sorting the content of xx.txt on windows
> from the windows box in a moment.
>
> the file xx.txt can be found at:
> https://github.com/wolski/imsbInfer/blob/master/xx.txt
>
>
>
More information about the R-help
mailing list