bert.tijhuis at wavin.com
2008-Nov-03 07:15 UTC
[Rd] sort returns a wrong index (PR#13242)
Full_Name: Bert Tijhuis Version: 2.8.0 OS: MS-Windows Submission from: (NULL) (217.140.7.52)> xd[1] 0.5 -1.0 0.2 NA -3.0 1.0 2.0 NA 2.0> sort(xd, index=T)$ix[1] 4 2 3 1 5 6 7 And in my believe it should be 5 2 3 1 6 7 8 4 9 This was function well in R 2.7.2 Good luck,
The default for na.last in sort() is NA (unlike sort.list):> sort.list(xd, na.last=NA)[1] 4 2 3 1 5 6 7 so the answer is correct (and the same as given by 2.7.2). On Mon, 3 Nov 2008, bert.tijhuis at wavin.com wrote:> Full_Name: Bert Tijhuis > Version: 2.8.0 > OS: MS-Windows > Submission from: (NULL) (217.140.7.52) > > >> xd > [1] 0.5 -1.0 0.2 NA -3.0 1.0 2.0 NA 2.0 > > >> sort(xd, index=T)$ix > [1] 4 2 3 1 5 6 7 > > > And in my believe it should be > 5 2 3 1 6 7 8 4 9The FAQ asks you to report only things you 'know for certain', not beliefs.> This was function well in R 2.7.2Indeed it did and gave the same answer as 2.8.0! -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595