Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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)
## S4 method for signature 'Views'
min(x, ..., na.rm = FALSE)

viewMaxs(x, na.rm=FALSE)
## S4 method for signature 'Views'
max(x, ..., na.rm = FALSE)

viewSums(x, na.rm=FALSE)
## S4 method for signature 'Views'
sum(x, ..., na.rm = FALSE)

viewMeans(x, na.rm=FALSE)
## S4 method for signature 'Views'
mean(x, ...)

viewWhichMins(x, na.rm=FALSE)
## S4 method for signature 'Views'
which.min(x)

viewWhichMaxs(x, na.rm=FALSE)
## S4 method for signature 'Views'
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.

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.

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.

Note

For convenience, methods for min, max, sum, mean, which.min and which.max are provided as wrappers around the corresponding view* functions (which might be deprecated at some point).

Author(s)

P. Aboyoun

See Also

Examples

## 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)

IRanges

Foundation of integer range manipulation in Bioconductor

v2.24.1
Artistic-2.0
Authors
H. Pagès, P. Aboyoun and M. Lawrence
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.