2025-01-12 00:52:51 +08:00

6 lines
151 B
R

# Given a numeric vector, convert to strings, sort, and convert back to
# numeric.
lexical_sort <- function(x) {
as.numeric(sort(as.character(x)))
}