
Internal 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)
An arbitrary R object for which a names
function
returns a character vector.
The same object as obj
, but sorted with .objects first.
# NOT RUN {
items <- c(A = "a", Z = "z", `.D` = ".d", `_C` = "_C")
.sortDotsUnderscoreFirst(items)
# 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)
# with a vector
.sortDotsUnderscoreFirst(c(".C", "_B", "A")) # _B is first
# }
Run the code above in your browser using DataLab