| 1 |
\name{size} |
| 2 |
|
| 3 |
\alias{size} |
| 4 |
\alias{size,Intervals-method} |
| 5 |
\alias{size,Intervals_full-method} |
| 6 |
|
| 7 |
\title{Compute interval sizes} |
| 8 |
|
| 9 |
\description{ |
| 10 |
Compute the size, in either Z or R as appropriate, for each interval |
| 11 |
in an interval matrix. |
| 12 |
} |
| 13 |
|
| 14 |
\usage{ |
| 15 |
\S4method{size}{Intervals}(x, as = type(x)) |
| 16 |
|
| 17 |
\S4method{size}{Intervals_full}(x, as = type(x)) |
| 18 |
} |
| 19 |
|
| 20 |
\arguments{ |
| 21 |
|
| 22 |
\item{x}{An \code{"Intervals"} or \code{"Intervals_full"} object.} |
| 23 |
|
| 24 |
\item{as}{ |
| 25 |
Should the intervals be thought of as in Z or R? This is usually |
| 26 |
determined automatically from the \code{type} slot, but because |
| 27 |
changing type may cause object copying, it is sometimes convenient |
| 28 |
to temporarily override this slot without actually resetting it. |
| 29 |
} |
| 30 |
|
| 31 |
} |
| 32 |
|
| 33 |
\details{ |
| 34 |
For type \code{"Z"} objects, counting measure; for type \code{"R"} |
| 35 |
objects, Lebesgue measure. For type \code{"Z"} objects, intervals of |
| 36 |
form (\emph{a},\emph{a}] and (\emph{a},\emph{a}) are both of length |
| 37 |
0. |
| 38 |
} |
| 39 |
|
| 40 |
\value{ |
| 41 |
A numeric vector with length equal to \code{nrow(x)}. |
| 42 |
} |
| 43 |
|
| 44 |
\seealso{ |
| 45 |
See \code{\link{empty}} to identify empty intervals. Note that when |
| 46 |
\code{type(x) == "R"}, a size of 0 does not imply that an interval is |
| 47 |
empty. |
| 48 |
} |
| 49 |
|
| 50 |
\examples{ |
| 51 |
z1 <- Intervals( cbind( 1, 1:3 ), type = "Z" ) |
| 52 |
z2 <- z1; closed(z2)[1] <- FALSE |
| 53 |
z3 <- z1; closed(z3) <- FALSE |
| 54 |
|
| 55 |
size(z1) |
| 56 |
size(z2) |
| 57 |
size(z3) |
| 58 |
|
| 59 |
r1 <- z1; type(r1) <- "R" |
| 60 |
r2 <- z2; type(r2) <- "R" |
| 61 |
r3 <- z3; type(r3) <- "R" |
| 62 |
|
| 63 |
size(r1) |
| 64 |
size(r2) |
| 65 |
size(r3) |
| 66 |
|
| 67 |
s1 <- Intervals_full( matrix( 1, 3, 2 ), type = "Z" ) |
| 68 |
closed(s1)[2,2] <- FALSE |
| 69 |
closed(s1)[3,] <- FALSE |
| 70 |
|
| 71 |
size(s1) |
| 72 |
} |
| 73 |
|