Generate quarterly, semester, or year breaks for dates
Source:R/quarter_breaks.R
breaks_quarters.Rd
This function generates breaks for quarterly, semester, or yearly intervals, either in fixed-width mode or automatic mode.
Arguments
- n
The number of breaks to generate in automatic mode.
- width
The fixed width of breaks in fixed-width mode. Should be a specification of the form
"n unit"
, wheren
is a number andunit
is one of "month", "quarter", or "year" (optionally plural). For example, "3 months", "1 quarter", or "2 years". If unit is months, value must be 3, 6 or 12 (so you get quarters). If unit is quarters, value must be 1, 2, or 4 (so you get quarters, semesters, or years). If unit is years, value must be 1.@note This function will never create breaks longer than one year. If that's desired, you're probably better off sticking with the standard ggplot approach
scale_x_date(date_breaks = "5 years", date_labels = "%y")
.