[Rd] change in sorting?

Thierry Onkelinx th|erry@onke||nx @end|ng |rom |nbo@be
Thu Jan 14 15:31:34 CET 2021


Dear all,

One of the unit tests for my package breaks only on r-devel under Windows (
https://cran.r-project.org/web/checks/check_results_git2rdata.html).
The unit test sorts a set of UTF-8 characters and writes them to disk. I've
noticed that the Euro symbol (€) gets a different place in r-devel under
Windows 10 compared to over combinations of R version and OS.

I know that sorting depends on the locale. Therefore I set the locale to
"C" prior to sorting. See the function below. After sorting, I reset the
locale to the existing one.

Is there something that I'm missing?

Best regards,

Thierry

set_c_locale <- function() {
  old_ctype <- Sys.getlocale(category = "LC_CTYPE")
  old_collate <- Sys.getlocale(category = "LC_COLLATE")
  old_time <- Sys.getlocale(category = "LC_TIME")
  old_monetary <- Sys.getlocale(category = "LC_MONETARY")
  Sys.setlocale(category = "LC_CTYPE", locale = "C")
  Sys.setlocale(category = "LC_COLLATE", locale = "C")
  Sys.setlocale(category = "LC_TIME", locale = "C")
  Sys.setlocale(category = "LC_MONETARY", locale = "C")
  return(
    c(
      ctype = old_ctype, collate = old_collate, time = old_time,
      monetary = old_monetary
    )
  )
}

ir. Thierry Onkelinx
Statisticus / Statistician

Vlaamse Overheid / Government of Flanders
INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE AND
FOREST
Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance
thierry.onkelinx using inbo.be
Havenlaan 88 bus 73, 1000 Brussel
www.inbo.be

///////////////////////////////////////////////////////////////////////////////////////////
To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to say
what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey
///////////////////////////////////////////////////////////////////////////////////////////

<https://www.inbo.be>

	[[alternative HTML version deleted]]



More information about the R-devel mailing list