make_labels_months: Make Months labels

Description Usage Arguments Details Value See Also Examples

View source: R/make_labels.R

Description

Make labels with the format expected for an object of class "Months" (as defined in the demarray package). This function would not normally be called directly by end users.

Usage

1

Arguments

x

A list of Date vectors.

Details

x is a list of Date vectors of length 2. If elements of a vector are non-NA, then the second element must one month after the first. Any non-NA elements must be the first day of a month. The vectors cannot overlap.

The elements of x are converted into labels as follows:

Element Label
as.Date(c("2020-01-01", "2020-01-01")) "2020 Jan"
as.Date(c(NA, "2020-01-01")) "<2020 Jan"
as.Date(c("2020-01-01", NA)) "2020 Jan+"
as.Date(c(NA, NA)) NA

Value

A character vector

See Also

make_labels_categories, make_labels_triangles, make_labels_directions, make_labels_quantiles, make_labels_integers, make_labels_intervals, make_labels_quantities, make_labels_quarters, make_labels_dateranges, make_labels_datepoints

Examples

1
2
3
4
5
6
x <- list(as.Date(c("2020-12-01", "2021-01-01")),
          as.Date(c(NA, "2020-01-01")),
          as.Date(c(NA_character_, NA_character_)),
          as.Date(c("2025-01-01", NA)),
          as.Date(c("2020-01-01", "2020-02-01")))
make_labels_months(x)

johnrbryant/demprep documentation built on Dec. 31, 2021, 11:58 a.m.