is_NA: Whether 'datey', 'durationy' or 'datey_interval' are NA

is_NAR Documentation

Whether datey, durationy or datey_interval are NA

Description

Valid datey system ranges:

  • Valid dates are from the start of 1000 to the start of 3000.

  • Valid durations are 2000 years or less in magnitude.

Values outside the above ranges are treated as NA.

is.na() tests whether a datey, durationy or datey_interval is NA by element.

anyNA() tests whether any element of a datey, durationy or datey_interval is NA.

For convenience,

  • the constants NA_datey_, NA_durationy_ and NA_datey_interval_ are the datey, durationy and datey_interval versions of NA respectively, and

  • integer constants describing the above valid ranges are also provided.

For performance reasons, intermediate datey system calculations are not required to check for NAs.

Throughout the datey package, NA will cause an error when used where a datey_, durationy_ or datey_interval_ is expected. This is because its type is logical and potentially indicates user error. If you want an NA value with a datey system type, use one of NA_datey_, NA_durationy_ or NA_datey_interval_.

Usage

## S3 method for class 'datey'
is.na(x)

## S3 method for class 'datey'
anyNA(x, recursive = FALSE)

## S3 method for class 'datey_interval'
is.na(x)

## S3 method for class 'datey_interval'
anyNA(x, recursive = FALSE)

## S3 method for class 'durationy'
is.na(x)

## S3 method for class 'durationy'
anyNA(x, recursive = FALSE)

Arguments

x

The datey, durationy or datey_interval to test for NA.

recursive

Currently required to be FALSE (the default).

Value

is.na() returns a vector of logical the same length as x. anyNA() always returns TRUE or FALSE, never NA and never anything other than a single value.

See Also

NA_datey_, NA_durationy_, NA_datey_interval_, integer_constants, datey, durationy, datey_interval

Examples

  t <- c(NA_datey_, datey(2000), datey(999.99, strict = FALSE))
  is.na(t)
  anyNA(t)

  d <- c(NA_durationy_, durationy(1.5))
  is.na(d)
  anyNA(d)

  i <- c(NA_datey_interval_, 2000 %to% 2001)
  is.na(i)
  anyNA(i)

datey documentation built on July 14, 2026, 5:06 p.m.