Yes, thanks. That seems to be it: thing <- c("M1", "M2", "M.1", "M.2") > sort(thing) [1] "M1" "M.1" "M2" "M.2"
The only documentation I can find is from ?Comparison: "Collation of non-letters (spaces, punctuation signs, hyphens, fractions and so on) is even more problematic." Indeed. Bob On 13 October 2016 at 11:26, PIKAL Petr <petr.pi...@precheza.cz> wrote: > Hi > > Just a wild guess. Dot is ignored and the output is alphabetically sorted. > > You could try sort it yourself by > > sort(ls()) > > Cheers > Petr > >> -----Original Message----- >> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Bob >> O'Hara >> Sent: Thursday, October 13, 2016 10:29 AM >> To: r-help <r-help@r-project.org> >> Subject: [R] (no subject) >> >> I've just come across an odd problem with sorting in ls(): it doesn't seem to >> order the object names correctly. If I do the following, the order isn't >> what I >> expect: >> >> > ls(sorted=TRUE) >> [1] "AridData" "AridDataToBUGS" "Arid.df" >> "Arid.hpd" "AridPrecip.sd" "Break.df" >> [7] "Break.hpd" "Cols" "Data" >> "DataFrames" "DataToBUGS" "DataToBUGS.nonlog" >> [13] "FitBRugs" "Fixed.df" "Fixed.hpd" >> "FormatData" "GetCol" "GetHPD" >> [19] "GetMCMC" "GetRow" "HPDIs" >> "Int.alpha12" "Int.alpha21" "ModisData" >> [25] "ModisDataToBUGS" "Modis.df" "ModisFixed.df" >> "ModisFixed.hpd" "Modis.hpd" "ModisPrecip.sd" >> [31] "ModisShrink.df" "ModisShrink.hpd" "ModisYears" >> "OrigData" "OrigDataToBUGS" "Orig.df" >> [37] "Orig.hpd" "OrigPrecip.sd" "OrigYears" >> "PlotChecks" "PlotEff" "plothpd" >> [43] "ProvinceNames" "ResNames" "ResNamesOrder" >> "Shrink.df" "Shrink.hpd" "SimInits" >> >> Specifically, the Modis* objects are sorted like this: >> >> > ls(sorted=TRUE)[26:30] >> [1] "Modis.df" "ModisFixed.df" "ModisFixed.hpd" "Modis.hpd" >> "ModisPrecip.sd" >> >> With Modis.* coming both before and after ModisF*. I can't see why there >> would be any odd problems with character sets changing (this was all done >> on a single computer with no weird locale switching), and the objects are all >> created within a single R session: >> >> > sessionInfo() >> R version 3.2.5 (2016-04-14) >> Platform: x86_64-pc-linux-gnu (64-bit) >> Running under: Ubuntu 16.04.1 LTS >> >> locale: >> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C >> LC_TIME=en_GB.UTF-8 LC_COLLATE=en_US.UTF-8 >> [5] LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_US.UTF-8 >> LC_PAPER=en_GB.UTF-8 LC_NAME=C >> [9] LC_ADDRESS=C LC_TELEPHONE=C >> LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C >> >> attached base packages: >> [1] stats graphics grDevices utils datasets methods base >> >> other attached packages: >> [1] MCMCglmm_2.22.1 ape_3.5 Matrix_1.2-7.1 >> RColorBrewer_1.1-2 plyr_1.8.4 coda_0.18-1 >> >> loaded via a namespace (and not attached): >> [1] cubature_1.1-2 corpcor_1.6.8 tools_3.2.5 Rcpp_0.12.7 >> nlme_3.1-128 grid_3.2.5 knitr_1.14 >> [8] tensorA_0.36 lattice_0.20-34 >> >> Can anyone explain what's going on? >> >> Bob >> >> -- >> Bob O'Hara >> >> Biodiversity and Climate Research Centre Senckenberganlage 25 >> D-60325 Frankfurt am Main, >> Germany >> >> Tel: +49 69 798 40226 >> Mobile: +49 1515 888 5440 >> WWW: http://www.bik-f.de/root/index.php?page_id=219 >> Blog: http://occamstypewriter.org/boboh/ >> Journal of Negative Results - EEB: www.jnr-eeb.org >> >> ______________________________________________ >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> 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. > > ________________________________ > Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou > určeny pouze jeho adresátům. > Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně > jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze > svého systému. > Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email > jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat. > Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či > zpožděním přenosu e-mailu. > > V případě, že je tento e-mail součástí obchodního jednání: > - vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, > a to z jakéhokoliv důvodu i bez uvedení důvodu. > - a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; > Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany > příjemce s dodatkem či odchylkou. > - trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným > dosažením shody na všech jejích náležitostech. > - odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost > žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně > pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu > případně osobě, kterou adresát zastupuje, předloženy nebo jejich existence je > adresátovi či osobě jím zastoupené známá. > > This e-mail and any documents attached to it may be confidential and are > intended only for its intended recipients. > If you received this e-mail by mistake, please immediately inform its sender. > Delete the contents of this e-mail with all attachments and its copies from > your system. > If you are not the intended recipient of this e-mail, you are not authorized > to use, disseminate, copy or disclose this e-mail in any manner. > The sender of this e-mail shall not be liable for any possible damage caused > by modifications of the e-mail or by delay with transfer of the email. > > In case that this e-mail forms part of business dealings: > - the sender reserves the right to end negotiations about entering into a > contract in any time, for any reason, and without stating any reasoning. > - if the e-mail contains an offer, the recipient is entitled to immediately > accept such offer; The sender of this e-mail (offer) excludes any acceptance > of the offer on the part of the recipient containing any amendment or > variation. > - the sender insists on that the respective contract is concluded only upon > an express mutual agreement on all its aspects. > - the sender of this e-mail informs that he/she is not authorized to enter > into any contracts on behalf of the company except for cases in which he/she > is expressly authorized to do so in writing, and such authorization or power > of attorney is submitted to the recipient or the person represented by the > recipient, or the existence of such authorization is known to the recipient > of the person represented by the recipient. -- Bob O'Hara Biodiversity and Climate Research Centre Senckenberganlage 25 D-60325 Frankfurt am Main, Germany Tel: +49 69 798 40226 Mobile: +49 1515 888 5440 WWW: http://www.bik-f.de/root/index.php?page_id=219 Blog: http://occamstypewriter.org/boboh/ Journal of Negative Results - EEB: www.jnr-eeb.org ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.