Description Usage Arguments Value See Also Examples

Determine which intervals in the one set are completely included in the intervals of a second set.

1 2 3 4 | ```
## S4 method for signature 'Intervals,Intervals'
interval_included(from, to, check_valid = TRUE)
## S4 method for signature 'Intervals_full,Intervals_full'
interval_included(from, to, check_valid = TRUE)
``` |

`from` |
An |

`to` |
An |

`check_valid` |
Should |

A list, with one element for each row/component of `from`

. The
elements are vectors of indices, indicating which `to`

rows (or
components, for the `"numeric"`

method) are completely included
within each interval in `from`

. A list element of length 0
indicates no included elements. Note that empty `to`

elements are
not included in anything, and empty `from`

elements do not
include anything.

See `interval_overlap`

for partial overlaps – i.e., at at
least a point.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | ```
# Note that 'from' and 'to' contain valid but empty intervals.
to <- Intervals(
matrix(
c(
2, 6,
2, 8,
2, 9,
4, 4,
6, 8
),
ncol = 2, byrow = TRUE
),
closed = c( TRUE, FALSE ),
type = "Z"
)
from <- Intervals(
matrix(
c(
2, 8,
8, 9,
6, 9,
11, 12,
3, 3
),
ncol = 2, byrow = TRUE
),
closed = c( TRUE, FALSE ),
type = "Z"
)
rownames(from) <- letters[1:nrow(from)]
from
to
interval_included(from, to)
closed(to) <- TRUE
to
interval_included(from, to)
# Intervals_full
F <- FALSE
T <- TRUE
to <- Intervals_full(
rep( c(2,8), c(4,4) ),
closed = matrix( c(F,F,T,T,F,T,F,T), ncol = 2 ),
type = "R"
)
type( from ) <- "R"
from <- as( from, "Intervals_full" )
from
to
interval_included(from, to)
# Testing
B <- 1000
x1 <- rexp( B, 1/1000 )
s1 <- runif( B, max=5 )
x2 <- rexp( B, 1/1000 )
s2 <- runif( B, max=3 )
from <- Intervals_full( cbind( x1, x1 + s1 ) )
to <- Intervals_full( cbind( x2, x2 + s2 ) )
ii <- interval_included( from, to )
ii_match <- which( sapply( ii, length ) > 0 )
from[ ii_match[1:3], ]
lapply( ii[ ii_match[1:3] ], function(x) to[x,] )
included <- to[ unlist( ii ), ]
dim( included )
interval_intersection( included, interval_complement( from ) )
``` |

intervals documentation built on May 31, 2017, 2:35 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.