brk_width-for-datetime: Equal-width intervals for dates or datetimes

brk_width-for-datetimeR Documentation

Equal-width intervals for dates or datetimes

Description

brk_width() can be used with time interval classes from base R or the lubridate package.

Usage

## S3 method for class 'Duration'
brk_width(width, start)

Arguments

width

A scalar difftime, Period or Duration object.

start

A scalar of class Date or POSIXct. Can be omitted.

Details

If width is a Period, lubridate::add_with_rollback() is used to calculate the widths. This can be useful for e.g. calendar months.

Examples


if (requireNamespace("lubridate")) {
  year2001 <- as.Date("2001-01-01") + 0:364
  tab_width(year2001, months(1),
        labels = lbl_discrete(" to ", fmt = "%e %b %y"))
}


santoku documentation built on Oct. 12, 2023, 5:13 p.m.