Learn R Programming

set6 (version 0.1.1)

isSubinterval: Test If Two Intervals Are Subintervals

Description

Test If Two Intervals Are Subintervals

Arguments

x

Set or list

proper

If TRUE then tests if x is a proper subinterval (i.e. subinterval and not equal to) of self, otherwise FALSE tests if x is a (non-proper) subinterval.

all

If TRUE then returns TRUE if all x are subintervals, otherwise returns a vector of logicals.

Value

If all is TRUE then returns TRUE if all x are subsets of the Set, otherwise FALSE. If all is FALSE then returns a vector of logicals corresponding to each individual element of x.

R6 Usage

$isSubinterval(x, proper = FALSE, all = FALSE)

Details

If x is a Set then will be coerced to an Interval if possible. isSubinterval differs from isSubset in that ordering and class are respected in isSubinterval. See examples for a clearer illustration of the difference.

See Also

isSubset

Examples

Run this code
# NOT RUN {
Interval$new(1,3)$isSubset(Set$new(1,2)) # TRUE
Interval$new(1,3)$isSubset(Set$new(2, 1)) # TRUE
Interval$new(1,3, class = "integer")$isSubinterval(Set$new(1, 2)) # TRUE
Interval$new(1,3)$isSubinterval(Set$new(1, 2)) # FALSE
Interval$new(1,3)$isSubinterval(Set$new(2, 1)) # FALSE

Reals$new()$isSubset(Integers$new()) # TRUE
Reals$new()$isSubinterval(Integers$new()) # FALSE
# }

Run the code above in your browser using DataLab