chk_no_overlap: Check that pairs of numbers specifying labels do not overlap

Description Usage Arguments Details Examples

Description

Look for cases where the first pair starts at or below the second pair, and finished in or above the second pair. Function 'outer' covers all combinations of pairs, in both orders, so looking only at overlaps from below finds all overlaps.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11

Arguments

x

A list of integer vectors of length 2.

name

The name for x to be used in error messages.

Details

Intervals allow the second number of the lower pair to equal the first number of the upper pair, while quantities do not.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
x <- list(c(NA, NA), c(NA, 20L), c(30L, NA), c(20L, 30L)) 
chk_no_overlap_pairs(x = x,
                     name = "x")

x <- list(as.Date(c(NA, "2020-10-01")),
          as.Date(c(NA, NA)),
          as.Date(c("2020-01-01", "2020-04-01")))
chk_no_overlap_quarters(x = x,
                        name = "x")

x <- list(as.Date(c(NA, "2020-10-01")),
          as.Date(c(NA, NA)),
          as.Date(c("2020-01-01", "2020-02-01")))
chk_no_overlap_months(x = x,
                      name = "x")

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