Learn R Programming

IRanges (version 2.6.1)

AtomicList-utils: Common operations on AtomicList objects

Description

Common operations on AtomicList objects.

Arguments

Group Generics

AtomicList objects have support for S4 group generic functionality to operate within elements across objects:
Arith
"+", "-", "*", "^", "%%", "%/%", "/"
Compare
"==", ">", "<"< code="">, "!=", "<="< code="">, ">="
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

Specialized Methods

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

See Also

Examples

Run this code
## 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)'

Run the code above in your browser using DataLab