Functions to compare and search spell intervals
spells.overlap checks if two spells overlap at all, spells.hit searches a spell matrix for an overlapping spell
spells.overlap(s1, s2) spells.hit(needle, haystack) search.spell(needle, haystack)
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 |
Spell overlap is defined as true if one of the following conditions sets is met, otherwise false:
onset1 >= onset2 AND onset1 < terminus2
terminus1 > onset2 AND terminus1 <= terminus2
onset1 <= onset2 AND terminus1 >= terminus2
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
skyebend@uw.edu
See Also activity.attribute
a <- c(1,3) b <- c(2,5.5) c <- c(-1,10) d <- c(4,4) spells.overlap(a,b) spells.overlap(b,c) spells.overlap(a,d) spellmat <- rbind(c(0,1), c(1,2), c(2,3)) spells.hit(c(1,2),spellmat)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.