IRanges (version 2.6.1)

view-summarization-methods: Summarize views on a vector-like object with numeric values

Description

viewApply applies a function on each view of a Views or ViewsList object.

viewMins, viewMaxs, viewSums, viewMeans calculate respectively the minima, maxima, sums, and means of the views in a Views or ViewsList object.

Usage

viewApply(X, FUN, ..., simplify = TRUE)
viewMins(x, na.rm=FALSE) "min"(x, ..., na.rm = FALSE)
viewMaxs(x, na.rm=FALSE) "max"(x, ..., na.rm = FALSE)
viewSums(x, na.rm=FALSE) "sum"(x, ..., na.rm = FALSE)
viewMeans(x, na.rm=FALSE) "mean"(x, ...)
viewWhichMins(x, na.rm=FALSE) "which.min"(x)
viewWhichMaxs(x, na.rm=FALSE) "which.max"(x)
viewRangeMins(x, na.rm=FALSE)
viewRangeMaxs(x, na.rm=FALSE)

Arguments

X
A Views object.
FUN
The function to be applied to each view in X.
...
Additional arguments to be passed on.
simplify
A logical value specifying whether or not the result should be simplified to a vector or matrix if possible.
x
An RleViews or RleViewsList object.
na.rm
Logical indicating whether or not to include missing values in the results.

Value

For all the functions in this man page (except viewRangeMins and viewRangeMaxs): A numeric vector of the length of x if x is an RleViews object, or a List object of the length of x if it's an RleViewsList object.For viewRangeMins and viewRangeMaxs: An IRanges object if x is an RleViews object, or an IRangesList object if it's an RleViewsList object.

Details

The viewMins, viewMaxs, viewSums, and viewMeans functions provide efficient methods for calculating the specified numeric summary by performing the looping in compiled code.

The viewWhichMins, viewWhichMaxs, viewRangeMins, and viewRangeMaxs functions provide efficient methods for finding the locations of the minima and maxima.

See Also

Examples

Run this code
## Views derived from coverage
x <- IRanges(start=c(1L, 9L, 4L, 1L, 5L, 10L),
             width=c(5L, 6L, 3L, 4L, 3L,  3L))
cvg <- coverage(x)
cvg_views <- slice(cvg, lower=2)

viewApply(cvg_views, diff)

viewMins(cvg_views)
viewMaxs(cvg_views)

viewSums(cvg_views)
viewMeans(cvg_views)

viewWhichMins(cvg_views)
viewWhichMaxs(cvg_views)

viewRangeMins(cvg_views)
viewRangeMaxs(cvg_views)

Run the code above in your browser using DataCamp Workspace