I want to keep a order after change big mark in numbers cut. The reproducible examples:
require(dplyr)
data <- c(rnorm(25, 2000, 500), 19, 10)
data <- data %>% cut(., breaks = 5, dig.lab = 4)
levels(data)
Results:
"(7.265,557]" "(557,1104]" "(1104,1651]" "(1651,2198]" "(2198,2748]"
When I change the format:
nd_data <- data %>% prettyNum(big.mark = ".") %>% as.factor()
levels(nd_data)
"(1.104,1.651]" "(1.651,2.198]" "(2.198,2.748]" " (557,1.104]" " (7.265,557]"
The order change. How to keep, without a manual change, because I have different data sets?