Learn R Programming

IntervalQuestionStat (version 0.2.0)

length: Get the length of an IntervalList object

Description

This function allows to get the length of an interval-valued list, that is, the number of different nonempty compact real intervals stored in an IntervalList object.

Usage

# S4 method for IntervalList
length(x)

Value

This function returns a single numeric value indicating the length of a list with several nonempty compact real intervals. Therefore, it always returns an integer

object of whose length is one.

Arguments

x

A list of nonempty compact real intervals stored as an IntervalList object.

Author

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

Examples

Run this code
## Some length() examples

list1 <- IntervalList(c(0, 2, 5), c(1, 6, 10))
length(list1)

dataframe <- data.frame(mids = c(0.5, 4, 7.5, 5),
                        sprs = c(0.5, 2, 2.5, 1))
list2 <- IntervalList(dataframe, type = 2)
length(list2)

Run the code above in your browser using DataLab