Raja Surapanani
2003-Aug-15 17:11 UTC
[R] Does order() behave differently on different platforms?
Hello, I am running R 1.7.1 on two platforms and it seems to me that order() behaves differently on them. I noticed this when a test case passed in linux but failed on solaris. This is the behavior on the solaris platform: R.Version() $platform [1] "sparc-sun-solaris2.8" $arch [1] "sparc" $os [1] "solaris2.8" $system [1] "sparc, solaris2.8" $status [1] "" $major [1] "1" $minor [1] "7.1" $year [1] "2003" $month [1] "06" $day [1] "16" $language [1] "R"> x <- c("a", "b", "c", "(d") > sort(x)[1] "(d" "a" "b" "c" This is the behavior on the linux platform:> R.Version()$platform [1] "i686-pc-linux-gnu" $arch [1] "i686" $os [1] "linux-gnu" $system [1] "i686, linux-gnu" $status [1] "" $major [1] "1" $minor [1] "7.1" $year [1] "2003" $month [1] "06" $day [1] "16" $language [1] "R" x <- c("a", "b", "c", "(d")> sort(x)[1] "a" "b" "c" "(d" Am I missing something here or is there really a difference in the way order() works on different platforms? Thanks for your help. Regards, Raja
Uwe Ligges
2003-Aug-15 17:56 UTC
[R] Does order() behave differently on different platforms?
Raja Surapanani wrote:> Hello, > > I am running R 1.7.1 on two platforms and it seems to me that order() behaves > differently on them. I noticed this when a test case passed in linux but > failed on solaris. This is the behavior on the solaris platform: > > R.Version() > $platform > [1] "sparc-sun-solaris2.8"[SNIP]>>x <- c("a", "b", "c", "(d") >>sort(x) > > [1] "(d" "a" "b" "c" > > This is the behavior on the linux platform: > > >>R.Version() > > $platform > [1] "i686-pc-linux-gnu"[SNIP]>>sort(x) > > [1] "a" "b" "c" "(d" > > Am I missing something here or is there really a difference in the way order() > works on different platforms? Thanks for your help.You missed to read the help page. ?sort tells us: "The sort order for character vectors will depend on the collating sequence of the locale in use: see Comparison." Please follow that reference and read ?Comparison as well. Uwe Ligges
Following Uwe's and Dirk's suggestions, here's a first pass at a list of interesting "general" help pages: ?Arithmetic ?Comparison ?Control ?DateTimeClasses ?Defunct ?Deprecated ?Devices ?Extract ?Foreign ?Logic ?Memory ?Paren ?Rdconv (RdUtils page: Rdconv, Rd2dvi, Rd2txt, Sd2Rd) ?Special (beta, gamma, choose, ...) ?Startup ?Syntax ?build (PkgUtils page: R CMD build, R cmd check) ?connections (file, pipe, ...) ?pi (Constants page: LETTERS, letters, month.abb, month.name, pi) Note that the RdUtils, PkgUtils, and Constants pages cannot be accessed through their names ("?RdUtils", etc). I'd also suggest two additional general pages (which do not currently exist): ?System (system, .Platform, Sys.info, Sys.getenv, Sys.putenv, getwd, setwd) ?Graphics (covering plot, lines, points, segments, par, Devices) -- -- David Brahm (brahm at alum.mit.edu)