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

AtomicList-utils

Common operations on AtomicList objects


Description

Common operations on AtomicList objects.

Group Generics

AtomicList objects have support for S4 group generic functionality to operate within elements across objects:

Arith

"+", "-", "*", "^", "%%", "%/%", "/"

Compare

"==", ">", "<", "!=", "<=", ">="

Logic

"&", "|"

Ops

"Arith", "Compare", "Logic"

Math

"abs", "sign", "sqrt", "ceiling", "floor", "trunc", "cummax", "cummin", "cumprod", "cumsum", "log", "log10", "log2", "log1p", "acos", "acosh", "asin", "asinh", "atan", "atanh", "exp", "expm1", "cos", "cosh", "sin", "sinh", "tan", "tanh", "gamma", "lgamma", "digamma", "trigamma"

Math2

"round", "signif"

Summary

"max", "min", "range", "prod", "sum", "any", "all"

Complex

"Arg", "Conj", "Im", "Mod", "Re"

See S4groupGeneric for more details.

Other Methods

The AtomicList objects also support a large number of basic methods. Like the group generics above, these methods perform the corresponding operation on each element of the list separately. The methods are:

Logical

!, which, which.max, which.min

Numeric

diff, pmax, pmax.int, pmin, pmin.int, mean, var, cov, cor, sd, median, quantile, mad, IQR

Running Window

smoothEnds, runmed. runmean, runsum, runwtsum, runq

Character

nchar, chartr, tolower, toupper, sub, gsub

The which.min and which.max functions have an extra argument, global=FALSE, which controls whether the returned subscripts are global (compatible with the unlisted form of the input) or local (compatible with the corresponding list element).

The rank method only supports tie methods “average”, “first”, “min” and “max”.

Since ifelse relies on non-standard evaluation for arguments that need to be in the generic signature, we provide ifelse2, which has eager but otherwise equivalent semantics.

Specialized Methods

unstrsplit(x, sep="")

: A fast sapply(x, paste0, collapse=sep). See ?unstrsplit for the details.

Author(s)

P. Aboyoun

See Also

Examples

## group generics
int1 <- c(1L,2L,3L,5L,2L,8L)
int2 <- c(15L,45L,20L,1L,15L,100L,80L,5L)
col1 <- IntegerList(one = int1, int2)
2 * col1
col1 + col1
col1 > 2
sum(col1)  # equivalent to (but faster than) 'sapply(col1, sum)'
mean(col1)  # equivalent to 'sapply(col1, mean)'

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.