How to order the rows by year and month, so the year 2022 month 10 and 11 are the last 2 rows? Thanks,
test <- data.frame(
stringsAsFactors = FALSE,
datec = c("03/21","04/21","08/21",
"10/22","11/22","05/22","07/22","08/22","09/22"),
year = c("2021","2021","2021","2022",
"2022","2022","2022","2022","2022"),
mon = c("3", "4", "8", "10", "11", "5", "7", "8", "9"),
row = c(1,2,3,4,5,6,7,8,9)
)
df <- test %>% arrange(year,mon)