AtomicList-utils | R Documentation |
Common operations on AtomicList objects.
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.
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:
!
, which
, which.max
, which.min
diff
,
pmax
, pmax.int
, pmin
, pmin.int
,
mean
, var
, cov
, cor
, sd
,
median
, quantile
, mad
, IQR
smoothEnds
, runmed
. runmean
,
runsum
, runwtsum
, runq
nchar
, chartr
, tolower
,
toupper
, sub
, gsub
,
startsWith
, endsWith
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.
unstrsplit(x, sep="")
:: A fast
sapply(x, paste0, collapse=sep)
. See ?unstrsplit
for the details.
P. Aboyoun
AtomicList objects.
## 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)'
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.