Skip to content

Commit

Permalink
minor speedup in sort_chr() (avoid duplicate argument matching)
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau committed Dec 23, 2024
1 parent 4bc8bc9 commit a00b5de
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions R/utils_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,8 @@ sort_chr <- function(x) {
old_locale <- Sys.getlocale(category = "LC_COLLATE")
on.exit(Sys.setlocale(category = "LC_COLLATE", locale = old_locale))
Sys.setlocale(category = "LC_COLLATE", locale = "C")
sort.int(
x = as.character(x),
decreasing = FALSE,
na.last = NA,
method = "radix",
index.return = FALSE
)
x <- as.character(x)
x[order(x, na.last = NA, decreasing = FALSE, method = "radix")]
}

enclass <- function(x, class) {
Expand Down

0 comments on commit a00b5de

Please sign in to comment.