| 1 |
\name{empty} |
| 2 |
|
| 3 |
\alias{empty} |
| 4 |
\alias{empty,Intervals-method} |
| 5 |
\alias{empty,Intervals_full-method} |
| 6 |
|
| 7 |
\title{Identify empty interval rows} |
| 8 |
|
| 9 |
\description{ |
| 10 |
A valid interval matrix may contain empty intervals: those with common |
| 11 |
endpoints, at least one of which is open. The \code{empty} method |
| 12 |
identifies these rows. |
| 13 |
} |
| 14 |
|
| 15 |
\usage{ |
| 16 |
\S4method{empty}{Intervals}(x) |
| 17 |
|
| 18 |
\S4method{empty}{Intervals_full}(x) |
| 19 |
} |
| 20 |
|
| 21 |
\arguments{ |
| 22 |
\item{x}{An \code{"Intervals"} or \code{"Intervals_full"} object.} |
| 23 |
} |
| 24 |
|
| 25 |
\details{ |
| 26 |
Intervals are deemed to be empty when their endpoints are equal and |
| 27 |
not both closed, or for \code{type == "Z"}, when their endpoints differ |
| 28 |
by 1 and both are open. The matrices \code{x} and \code{x[!empty(x),]} |
| 29 |
represent the same subset of the integers or the real line. |
| 30 |
} |
| 31 |
|
| 32 |
\value{ |
| 33 |
A boolean vector with length equal to \code{nrow(x)}. |
| 34 |
} |
| 35 |
|
| 36 |
\section{Warning}{ |
| 37 |
Exact equality (\code{==}) comparisons are used by \code{empty}. See |
| 38 |
the package vignette for a discussion of equality and floating point |
| 39 |
numbers. |
| 40 |
} |
| 41 |
|
| 42 |
\note{ |
| 43 |
Note that intervals of size 0 may not be empty over the reals, and |
| 44 |
intervals whose second endpoint is strictly greater than the first |
| 45 |
\emph{may} be empty over the integers, if both endpoints are open. |
| 46 |
} |
| 47 |
|
| 48 |
\seealso{ |
| 49 |
See \code{\link{size}} to compute the size of each interval in an |
| 50 |
object. |
| 51 |
} |
| 52 |
|
| 53 |
\examples{ |
| 54 |
z1 <- Intervals( cbind( 1, 1:3 ), type = "Z" ) |
| 55 |
z2 <- z1; closed(z2)[1] <- FALSE |
| 56 |
z3 <- z1; closed(z3) <- FALSE |
| 57 |
|
| 58 |
empty(z1) |
| 59 |
empty(z2) |
| 60 |
empty(z3) |
| 61 |
|
| 62 |
r1 <- z1; type(r1) <- "R" |
| 63 |
r2 <- z2; type(r2) <- "R" |
| 64 |
r3 <- z3; type(r3) <- "R" |
| 65 |
|
| 66 |
empty(r1) |
| 67 |
empty(r2) |
| 68 |
empty(r3) |
| 69 |
|
| 70 |
s1 <- Intervals_full( matrix( 1, 3, 2 ), type = "Z" ) |
| 71 |
closed(s1)[2,2] <- FALSE |
| 72 |
closed(s1)[3,] <- FALSE |
| 73 |
|
| 74 |
empty(s1) |
| 75 |
} |
| 76 |
|