| mid | R Documentation |
This functions provides customized access to the mid slot of
IntervalData, IntervalList, and IntervalMatrix objects,
so the mid-points of the intervals can be extracted and replaced. This does
not prevent to use the @ accessor, but does not force others to know the
implementation details.
## S4 method for signature 'IntervalData' mid(object) ## S4 method for signature 'IntervalList' mid(object) ## S4 method for signature 'IntervalMatrix' mid(object) ## S4 replacement method for signature 'IntervalData' mid(object) <- value ## S4 replacement method for signature 'IntervalList' mid(object) <- value ## S4 replacement method for signature 'IntervalMatrix' mid(object) <- value
object |
A single nonempty compact interval or a list or matrix
with some intervals of this family, that is, an
|
value |
A |
On the one hand, mid() function returns the mid-points of the
intervals contained in IntervalData, IntervalList, or
IntervalMatrix instances stored as a single numeric value, a
numeric vector, or a matrix object, respectively. On the other
hand, mid<- command does not return any value since it only allows to
replace the mid slot of the given interval-valued object.
José García-García garciagarjose@uniovi.es
For accessing spr slot of interval-valued objects, spr()
function can be used.
## Some mid() function examples
## With IntervalData objects
interval <- IntervalData(0, 1)
mid(interval)
mid(interval) <- 0.75
mid(interval)
## With IntervalList objects
list <- IntervalList(c(1, 3, 5), c(2, 4, 6))
mid(list[c(1, 3)])
mid(list[c(1, 3)]) <- c(1, 3)
mid(list[c(1, 3)])
## With IntervalMatrix objects
m <- IntervalMatrix(matrix(c(1, 5, 2, 6, 6, 2,
7, 3, 3, 4, 4, 5), 2, 6))
mid(m[1, 1])
mid(m[1, 1]) <- 2
mid(m[1, 1])
mid(m[1, 1:2])
mid(m[1, 1:2]) <- c(2, 3)
mid(m[1, 1:2])
mid(m[, c(1, 3)])
mid(m[, c(1, 3)]) <- matrix(1:4, 2, 2)
mid(m[, c(1, 3)])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.