| spr {IntervalQuestionStat} | R Documentation |
Extract and replace the spreads of interval-valued objects
Description
This functions provides customized access to the spr slot of
IntervalData, IntervalList, and IntervalMatrix objects,
so their spreads can be extracted and replaced. This does not prevent to use
the @ accessor, but does not force others to know the implementation details.
Usage
## S4 method for signature 'IntervalData'
spr(object)
## S4 method for signature 'IntervalList'
spr(object)
## S4 method for signature 'IntervalMatrix'
spr(object)
## S4 replacement method for signature 'IntervalData'
spr(object) <- value
## S4 replacement method for signature 'IntervalList'
spr(object) <- value
## S4 replacement method for signature 'IntervalMatrix'
spr(object) <- value
Arguments
object |
A single nonempty compact interval or a list or matrix
with some intervals of this family, that is, an
|
value |
A |
Value
On the one hand, spr() function returns the spreads 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, spr<- command does not return any value since it only allows to
replace the spr slot of the given interval-valued object.
Author(s)
José García-García garciagarjose@uniovi.es
See Also
For accessing mid slot of interval-valued objects, mid()
function can be used.
Examples
## Some mid() function examples
## With IntervalData
interval <- IntervalData(0, 1)
spr(interval)
spr(interval) <- 0.75
spr(interval)
## With IntervalList
list <- IntervalList(c(1, 3, 5), c(2, 4, 6))
spr(list[c(1, 3)])
spr(list[c(1, 3)]) <- c(1, 3)
spr(list[c(1, 3)])
## With IntervalMatrix
m <- IntervalMatrix(matrix(c(1, 5, 2, 6, 6, 2,
7, 3, 3, 4, 4, 5), 2, 6))
spr(m[1, 1])
spr(m[1, 1]) <- 2
spr(m[1, 1])
spr(m[1, 1:2])
spr(m[1, 1:2]) <- c(2, 3)
spr(m[1, 1:2])
spr(m[, c(1, 3)])
spr(m[, c(1, 3)]) <- matrix(1:4, 2, 2)
spr(m[, c(1, 3)])