Hello useRs,

The results of the SORT function differ from Scilab/Matlab for Complex Numbers in my example.
This design is the desirable in R?

Thanks.
Cleber

r <- c(
1.7507+0.1689i, 1.7507-0.1689i, 1.3886+0.0000i, 1.0458+0.0792i, 1.0458-0.0792i, 0.8279+0.1861i, 0.8279-0.1861i, 0.8263+0.3731i, 0.8263-0.3731i, 0.6548+0.0000i
)

> cbind(sort(r, d=T))
                [,1]
 [1,] 1.7507+0.1689i
 [2,] 1.7507-0.1689i
 [3,] 1.3886+0.0000i
 [4,] 1.0458+0.0792i
 [5,] 1.0458-0.0792i
 [6,] 0.8279+0.1861i
 [7,] 0.8279-0.1861i
 [8,] 0.8263+0.3731i
 [9,] 0.8263-0.3731i
[10,] 0.6548+0.0000i
>

Scilab
-->gsort(r)
 ans  =

    1.7507 + 0.1689i
    1.7507 - 0.1689i
    1.3886
    1.0458 + 0.0792i
    1.0458 - 0.0792i
    0.8263 + 0.3731i
    0.8263 - 0.3731i
    0.8279 + 0.1861i
    0.8279 - 0.1861i
    0.6548

> sessionInfo()
R version 2.15.2 (2012-10-26)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=Portuguese_Brazil.1252 LC_CTYPE=Portuguese_Brazil.1252
[3] LC_MONETARY=Portuguese_Brazil.1252 LC_NUMERIC=C
[5] LC_TIME=Portuguese_Brazil.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods base

other attached packages:
[1] R.matlab_1.6.1    R.oo_1.10.2       R.methodsS3_1.4.2

loaded via a namespace (and not attached):
[1] MASS_7.3-22  tools_2.15.2
>

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to