One of the problems with the Gregorian calendar is that months are not alphabetical. In R the default sorting of strings is in alphabetical order. For tables and graphs of data by month this may mean repeated creation of month variables, which is tedious.

nice_month_string(x, abbreviated_out = FALSE, year_type = "calendar")

Arguments

x

A month string, will take either abbreviated or full length month strings

abbreviated_out

Should the output be abbreviated? default = FALSE

year_type

string, either calendar or financial (year starts April)

Value

A factor with months in order as the occur in the year.

Examples

nice_month_string(x = "Dec", abbreviated_out = FALSE, year_type = "calendar")
#> [1] December
#> 12 Levels: January February March April May June July August ... December