| overlaps {diyar} | R Documentation |
Overlapping number line objects
Description
Identify overlapping number_line objects
Usage
overlaps(x, y, methods = 8)
overlap(x, y)
none(x, y)
exact(x, y)
across(x, y)
x_across_y(x, y)
y_across_x(x, y)
chain(x, y)
x_chain_y(x, y)
y_chain_x(x, y)
aligns_start(x, y)
x_aligns_start_y(x, y)
y_aligns_start_x(x, y)
aligns_end(x, y)
x_aligns_end_y(x, y)
y_aligns_end_x(x, y)
inbetween(x, y)
x_inbetween_y(x, y)
y_inbetween_x(x, y)
overlap_method(x, y)
include_overlap_method(methods)
exclude_overlap_method(methods)
overlap_method_codes(methods)
overlap_method_names(methods)
Arguments
x |
|
y |
|
methods |
|
Details
There are 6 mutually exclusive types of overlap;
-
exact()- identicalstart_pointandend_pointpoints. -
inbetween()- Bothstart_pointandend_pointof onenumber_lineobject are within thestart_pointandend_pointof another. -
across()- Only thestart_pointorend_pointof onenumber_lineobject is in between thestart_pointandend_pointof another. -
chain()-end_pointof onenumber_lineobject is identical to thestart_pointof another. -
aligns_start()- identicalstart_pointonly. -
aligns_end()- identicalend_pointonly.
Except exact(), each type of overlap has two variations;
-
x_`method`_y()-number_line-xstarts beforenumber_line-y. -
y_`method`_x()-number_line-ystarts beforenumber_line-x.
There are two mutually inclusive types of overlap;
-
overlap()- a convenient option to select "ANY" and "ALL" type of overlap. -
none()- a convenient option to select "NO" type of overlap.
Selecting multiple types of overlap;
-
overlaps()- select specific type(s) of overlap. -
overlap_method()- return the type of overlap for a pair ofnumber_lineobjects. -
overlap_method_codes()- return the corresponding overlap method code for a specific type(s) of overlap. -
overlap_method_names()- return the corresponding type(s) of overlap for a specific overlap code. -
include_overlap_method()- return acharacter(1)value for specified type(s) of overlap. -
exclude_overlap_method()- return acharacter(1)value for all type(s) of overlap except those specified.
Value
logical; character
See Also
Examples
a <- number_line(-100, 100)
g <- number_line(100, 100)
overlaps(a, g)
# It's neither an "exact" or "chain"-overlap
overlaps(a, g, methods = "exact|chain")
# It's an "aligns_end"-overlap
overlap_method(a, g)
overlaps(a, g, methods = "exact|chain|x_aligns_end_y")
# Corresponding overlap code
overlap_method_codes("exact|chain|x_aligns_end_y")
include_overlap_method(c("exact", "chain", "x_aligns_end_y"))
# Corresponding overlap name
overlap_method_names(overlap_method_codes("exact|chain|x_aligns_end_y"))
# Every other type overlap
exclude_overlap_method(c("exact", "chain", "x_aligns_end_y"))
overlap_method_names(exclude_overlap_method(c("exact", "chain", "x_aligns_end_y")))
# All the above is based on tests for each specific type of overlap as seen below
none(a, g)
exact(a, g)
across(a, g)
x_across_y(a, g)
y_across_x(a, g)
chain(a, g)
x_chain_y(a, g)
y_chain_x(a, g)
inbetween(a, g)
x_inbetween_y(a, g)
y_inbetween_x(a, g)
aligns_start(a, g)
x_aligns_start_y(a, g)
y_aligns_start_x(a, g)
aligns_end(a, g)
x_aligns_end_y(a, g)
y_aligns_end_x(a, g)