| interval_nature | R Documentation |
datey_intervalTest whether intervals, [a,b), are 'proper' or 'collapsed':
A proper interval does not end before its start,
i.e. a \le b.
A collapsed interval does not start before its end,
i.e. a \ge b.
An NA interval is treated as collapsed and improper.
These definitions imply the following:
A collapsed interval could be empty or improper.
To test for an empty interval, i.e. [a,a), test that it is both
proper and collapsed.
These methods are guaranteed to return TRUE or FALSE, i.e. not NA
(provided the argument is an interval).
Vector versions mapping each element of x to TRUE or FALSE:
is_proper(x) tests whether the elements of x are proper.
is_collapsed(x) tests whether the elements of x are collapsed.
Scalar versions mapping x to a scalar TRUE or FALSE:
all_proper(x) tests whether all the elements of x are proper.
all_collapsed(x) tests whether all the elements of x are collapsed.
any_collapsed(x) tests whether at least one of the elements of x is
collapsed.
(any_proper() is not implemented because there is no obvious use case.)
These are S3 generic functions.
is_proper(x)
## Default S3 method:
is_proper(x)
## S3 method for class 'datey_interval'
is_proper(x)
all_proper(x)
## Default S3 method:
all_proper(x)
## S3 method for class 'datey_interval'
all_proper(x)
is_collapsed(x)
## Default S3 method:
is_collapsed(x)
## S3 method for class 'datey_interval'
is_collapsed(x)
all_collapsed(x)
## Default S3 method:
all_collapsed(x)
## S3 method for class 'datey_interval'
all_collapsed(x)
any_collapsed(x)
## Default S3 method:
any_collapsed(x)
## S3 method for class 'datey_interval'
any_collapsed(x)
x |
The interval to test. |
is_XXX functions return a logical vector corresponding the property.
all_XXX and any_XXX functions return a logical scalar.
datey_interval, interval_properties, interval_includes
non_empty <- 1900 %to% 2000
empty <- 2000 %to% 2000
improper <- 2000 %to% 1900
na <- NA_datey_interval_
is_collapsed(non_empty) # FALSE
is_collapsed(empty) # TRUE
is_collapsed(improper) # TRUE
is_collapsed(na) # TRUE
is_proper(non_empty) # TRUE
is_proper(empty) # TRUE
is_proper(improper) # FALSE
is_proper(na) # FALSE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.