apply {IntervalQuestionStat}R Documentation

Apply functions over IntervalMatrix margins

Description

This function allows to apply a function over the rows or columns of an interval-valued matrix.

Usage

## S4 method for signature 'IntervalMatrix'
apply(X, MARGIN, FUN)

Arguments

X

A matrix of interval-valued data stored as an IntervalMatrix object.

MARGIN

A single numeric value giving the direction which the function will be applied over. In this case, only two different options are allowed:

  • 1: The function will be applied by rows.

  • 2: The function will be applied by columns.

FUN

The function to be applied over the selected interval-valued matrix margins.

Value

This function returns the numeric vector or the list of interval-valued data attained by applying the selected function to the specified margin (rows or columns) of an interval-valued matrix. Therefore, this function always returns either a numeric or either an IntervalList object, respectively.

Author(s)

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

Examples

## Some apply() examples
## IntervalMatrix definition
m <- IntervalMatrix(matrix(c(0, 1, 2, 3, 0, 3, 4, 9), 2, 4))
## Calculate sample Aumann means by rows and columns
## These code lines return IntervalList objects
apply(m, 1, mean)
apply(m, 2, mean)
## Calculate sample Fréchet variance by rows and columns
## These code lines return numeric vectors
apply(m, 1, var)
apply(m, 2, var)

[Package IntervalQuestionStat version 0.2.0 Index]