date_to_cmonth: date_to_cmonth

View source: R/date_to_cmonth.R

date_to_cmonthR Documentation

date_to_cmonth

Description

Convert a date to a calendar month, either as a numeric value, or as an ordered factor.

Usage

date_to_cmonth(x, as_factor = FALSE)

Arguments

x

A date

as_factor

TRUE or FALSE, defaults to FALSE

Value

Either a numeric value giving the month of the year (1 = January) or a factor with the name of the month of the year.

Examples


x <- as.Date("01/01/2019", format = "%d/%m/%Y")
date_to_cmonth(x)
date_to_cmonth(x, as_factor = TRUE)

PublicHealthEngland/hcaidcs documentation built on Jan. 19, 2024, 8:38 a.m.