[Rd] sort function (PR#9309)

Uwe Ligges ligges at statistik.uni-dortmund.de
Sat Oct 21 14:59:35 CEST 2006



Ulrike Grömping wrote:
> What Luis probably means can be reproduced by this little example:
> 
> a<-5:1
> b<-t(t(a))
> b
> sort(b)
> 
> In R 2.2.1 (Windows XP), sort(b) is a matrix with 1 column, like b. In R 2.4.0 (and presumably already 2.3.1), sort(b) is no longer a matrix but a vector (and displayed as a row).

I see. This is not a bug. It *was* a bug in R < 2.3.0 and has been 
fixed. From NEWS:

     o   sort() now does not return inappropriate attributes such as
     "dim" and "tsp": it only returns names.

You cannot expect sort to do anything meaningful when applied to 
matrices or arrays other than returning a sorted vector of the elements, 
and that is what sort does nowadays.

Best,
Uwe Ligges


> Regards, Ulrike
> 
> ---------- Original Message -----------
> From: Uwe Ligges <ligges at statistik.uni-dortmund.de> 
> To: lfrank at cema.edu.ar 
> Cc: r-devel at stat.math.ethz.ch 
> Sent: Fri, 20 Oct 2006 23:09:02 +0200 
> Subject: Re: [Rd] sort function (PR#9309)
> 
>> lfrank at cema.edu.ar wrote: 
>>> Full_Name: Luis Frank 
>>> Version: 2.3.1 
>>> OS: 
>>> Submission from: (NULL) (168.96.156.79) 
>>>
>>>
>>> Hallo! 
>>>
>>> In version 2.3.1 tha sort function applied to a vector trasposes it. This does 
>>> not happen in earlier versions. As a consequence, old programms don´t work in 
>>> newer versions. 
>>>
>>> Thanks! 
>>> Luis 
>> Please read the FAQ how to report bugs. 
>>
>> 1. You are using an outdated version of R, please only report bugs of 
>> recent R versions. 
>> 2. You have not given your OS. 
>> 3. You have not given an example that reproduces the bug, my try does 
>> not transpose anything: 
>>  x <- 5:1 
>>  x 
>>  sort(x) 
>>
>> So, please .... 
>>
>> Uwe Ligges 
>>
>>> ______________________________________________ 
>>> R-devel at r-project.org mailing list 
>>> https://stat.ethz.ch/mailman/listinfo/r-devel 
>> ______________________________________________ 
>> R-devel at r-project.org mailing list 
>> https://stat.ethz.ch/mailman/listinfo/r-devel 
> ------- End of Original Message -------
> 
>  
>




More information about the R-devel mailing list