You have to specify the order of the levels for the factor, otherwise, it gets ordered alphabetically. See this example:
months <- c("January", "February", "March", "April")
as.factor(months)
#> [1] January February March April
#> Levels: April February January March
factor(months, levels = c("January", "February", "March", "April"))
#> [1] January February March April
#> Levels: January February March April
Created on 2020-03-24 by the reprex package (v0.3.0.9001)