spells.overlap: Functions to compare and search spell intervals
Description
spells.overlap checks if two spells overlap at all, spells.hit searches a spell matrix for an overlapping spell
Usage
spells.overlap(s1, s2)
spells.hit(needle, haystack)
search.spell(needle, haystack)
Arguments
s1
First spell for in the comparison, must be a two-element numeric vector in the form [onset,terminus]
s2
Second spell for in the comparison, must be a two-element numeric vector in the form [onset,terminus]
needle
The query spell used in the search, must be a two-element numeric vector in the form [onset,terminus]
haystack
The spell matrix to be searched by needle. Must be two column numeric matrix meeting the order specifications of a spell matrix. See activity.attribute
Value
spells.overlap returns a boolean indicating if the two spells overlap or not.
spells.hit returns the integer row index of the first (earliest) spell in haystack that overlaps with needle, or -1 if no overlaps are found
search.spell returns a vector containing the row indices of spells in haystack that overlap with needle, or numeric(0) if none found
Details
Spell overlap is defined as true if one of the following conditions sets is met, otherwise false: