6 lines
151 B
R
Raw Normal View History

2025-01-12 00:52:51 +08:00
# Given a numeric vector, convert to strings, sort, and convert back to
# numeric.
lexical_sort <- function(x) {
as.numeric(sort(as.character(x)))
}