contract: Contract lists of dates into messy dates

View source: R/contract.R

contractR Documentation

Contract lists of dates into messy dates

Description

This function operates as the opposite of expand(). It contracts a list of dates into the abbreviated annotation of messy dates.

Usage

contract(x, collapse = TRUE)

Arguments

x

A list of dates

collapse

Do you want ranges to be collapsed? TRUE by default. If FALSE ranges are returned in compact format.

Value

A mdate vector

Examples

d <- as_messydate(c("2001-01-01", "2001-01", "2001",
"2001-01-01..2001-02-02", "{2001-10-01,2001-10-04}",
"{2001-01,2001-02-02}", "28 BC", "-2000-01-01"))
e <- expand(d)
tibble::tibble(d, contract(e))

messydates documentation built on July 21, 2022, 5:11 p.m.