chk_first_day_unit_scalar: Check dates are the first day of the specified unit

Description Usage Arguments Details See Also Examples

View source: R/chk-composite.R

Description

If unit is "months", then "2000-03-01" is the first day of the specified unit, but "2000-03-02" is not.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11

Arguments

x

A scalar or vector of dates, or values that can be coerced to dates.

name

The name for x that will be used in error messages.

unit

Measurement units for time, eg "month".

Details

chk_first_day_unit_consec adds the requirement that the dates be consecutive.

See Also

chk_is_date_equiv

Examples

1
2
3
4
5
x <- "2020-01-01"
chk_first_day_unit_scalar(x, name = "x", unit = "year")
x <- c("2020-01-01", "2020-02-01")
chk_first_day_unit_vector(x, name = "x", unit = "month")
chk_first_day_unit_consec(x, name = "x", unit = "month")

johnrbryant/demcheck documentation built on Dec. 31, 2021, 11:57 a.m.