R/cache-helpers.R
sortDotsUnderscoreFirst.RdInternal use only. This exists so Windows, Linux, and Mac machines can have the same order after a sort. It will put dots and underscores first (with the sort key based on their second character, see examples. It also sorts lower case before upper case.
.sortDotsUnderscoreFirst(obj) .orderDotsUnderscoreFirst(obj)
| obj | An arbitrary R object for which a |
|---|
The same object as obj, but sorted with .objects first.
items <- c(A = "a", Z = "z", `.D` = ".d", `_C` = "_C") .sortDotsUnderscoreFirst(items)#> _C .D A Z #> "_C" ".d" "a" "z"# dots & underscore (using 2nd character), then all lower then all upper items <- c(B = "Upper", b = "lower", A = "a", `.D` = ".d", `_C` = "_C") .sortDotsUnderscoreFirst(items)#> _C .D b A B #> "_C" ".d" "lower" "a" "Upper"# with a vector .sortDotsUnderscoreFirst(c(".C", "_B", "A")) # _B is first#> [1] "_B" ".C" "A"