plot_date_to_cohort_year: Depict the intervals created by function...

Description Usage Arguments Details Examples

View source: R/plot_date_to_cohort.R

Description

Create a plot illustrating how function date_to_cohort_year works.

Usage

1
plot_date_to_cohort_year(date, month_start = "Jan", label_year_start = TRUE)

Arguments

date

Dates of events or measurements.

month_start

An element of month.name, or month.abb. The cohort starts on the first day of this month.

label_year_start

Whether to label a cohort by the calendar year at the beginning of the cohort or the calendar year at the end. Not needed for cohorts that start on 1 January. Defaults to TRUE.

Details

plot_date_to_cohort_year is typically used for learning or documentation, rather than for actual data analysis.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
plot_date_to_cohort_year(date = c("2024-03-27",
                                  "2022-11-09"))

## starts on 1 July rather than 1 January
plot_date_to_cohort_year(date = c("2024-03-27",
                                  "2022-11-09"),
                         month_start = "Jul")

## starts on 1 July rather than 1 January,
## and uses calendar year at end rather than
## calendar year at the beginning
plot_date_to_cohort_year(date = c("2024-03-27",
                                  "2022-11-09"),
                         month_start = "Jul",
                         label_year_start = FALSE)

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