IntervalList {IntervalQuestionStat}R Documentation

Create an IntervalList object

Description

For convenience, IntervalList objects or instances may be created with this function.

Usage

IntervalList(x, y = NULL, type = 1)

Arguments

x

A numeric vector, matrix or data.frame.

y

NULL (default) or a numeric vector with compatible dimensions to x.

type

A single real number specifying the characterization that is being used stored as a unique numeric value. Only the following two options are allowed:

  • 1: The inf/sup-characterization is used (default).

  • 2: The mid/spr-characterization is used.

Details

In order to create an IntervalList object, the information that defines the intervals of the list (either the lower and upper bounds or either the mid-points and the spreads) can be given as input to IntervalList() function in two different ways. On the one hand, each type of characterizing point can be stored separately in two numeric vectors and then they are passed to the function through x and y arguments. On the other hand, they can be stored jointly in a matrix or data.frame and then only x argument is used (y is left as NULL as it is defined by default).

Value

This function returns the created IntervalList object.

Author(s)

José García-García garciagarjose@uniovi.es

See Also

For other interval-valued data definition use IntervalData() and IntervalMatrix() functions.

Examples

## The following code generates the same list of intervals in four
## different ways by using different characterizations. In particular,
## the following list made up of three intervals is defined,
## {[0, 1], [2, 6], [5, 10] = [0.5 -+ 0.5], [4 -+ 2], [7.5 -+ 2.5]}.

## First, inf/sup-characterization stored in two vectors is used.
list1 <- IntervalList(c(0, 2, 5), c(1, 6, 10)); list1
## Then, mid/spr-characterization stored in two vectors is used.
list2 <- IntervalList(c(0.5, 4, 7.5), c(0.5, 2, 2.5), type = 2); list2
## Then, inf/sup-characterization stored in a matrix is used.
matrix <- matrix(c(0, 2, 5, 1, 6, 10), 3, 2)
list3 <- IntervalList(matrix); list3
## Finally, mid/spr-characterization stored in a data.frame is used.
dataframe <- data.frame(mids = c(0.5, 4, 7.5), sprs = c(0.5, 2, 2.5))
list4 <- IntervalList(dataframe, type = 2); list4

[Package IntervalQuestionStat version 0.2.0 Index]