groupGenerics {SomaDataIO} | R Documentation |
Group Generics for soma_adat
Class Objects
Description
S3 group generic methods to apply group specific prototype functions
to the RFU data only of soma_adat
objects.
The clinical meta data are not transformed and remain unmodified in
the returned object (Math()
and Ops()
) or are ignored for the
Summary()
group. See groupGeneric()
.
Usage
## S3 method for class 'soma_adat'
Math(x, ...)
antilog(x, base = 10)
## S3 method for class 'soma_adat'
Ops(e1, e2 = NULL)
## S3 method for class 'soma_adat'
Summary(..., na.rm = FALSE)
## S3 method for class 'soma_adat'
e1 == e2
Arguments
x |
The |
... |
Additional arguments passed to the various group generics as appropriate. |
base |
A positive or complex number: the base with respect to which logarithms are computed. |
e1 , e2 |
Objects. |
na.rm |
Logical. Should missing values be removed? |
Value
A soma_adat
object with the same dimensions of the input
object with the feature columns transformed by the specified generic.
Functions
-
antilog()
: performs the inverse or anti-log transform for a numeric vector ofsoma_adat
object. note: default isbase = 10
, which differs from thelog()
default base e. -
Ops(soma_adat)
: performs binary mathematical operations on classsoma_adat
. SeeOps()
. -
Summary(soma_adat)
: performs summary calculations on classsoma_adat
. SeeSummary()
. -
==
: compares left- and right-hand sides of the operator unless the RHS is also asoma_adat
, in which casediffAdats()
is invoked.
Math
Group members:
#> [1] "abs" "acos" "acosh" "asin" "asinh" "atan" #> [7] "atanh" "ceiling" "cos" "cosh" "cospi" "cummax" #> [13] "cummin" "cumprod" "cumsum" "digamma" "exp" "expm1" #> [19] "floor" "gamma" "lgamma" "log" "log10" "log1p" #> [25] "log2" "sign" "sin" "sinh" "sinpi" "sqrt" #> [31] "tan" "tanh" "tanpi" "trigamma" "trunc"
Commonly used generics of this group include:
-
log()
,log10()
,log2()
,antilog()
,abs()
,sign()
,floor()
,sqrt()
,exp()
Ops
Group members:
#> [1] "+" "-" "*" "^" "%%" "%/%" "/" "==" ">" "<" "!=" "<=" #> [13] ">="
Note that for the `==`
method if the RHS is also a soma_adat
,
diffAdats()
is invoked which compares LHS vs. RHS.
Commonly used generics of this group include:
-
+
,-
,*
,/
,^
,==
,>
,<
Summary
Group members:
#> [1] "all" "any" "max" "min" "prod" "range" "sum"
Commonly used generics of this group include:
-
max()
,min()
,range()
,sum()
,any()
Author(s)
Stu Field
See Also
groupGeneric()
, getGroupMembers()
, getGroup()
Examples
# subset `example_data` for speed
# all SeqIds from 2000 -> 2999
seqs <- grep("^seq\\.2[0-9]{3}", names(example_data), value = TRUE)
ex_data_small <- head(example_data[, c(getMeta(example_data), seqs)], 10L)
dim(ex_data_small)
ex_data_small$seq.2991.9
# Math Generics:
# -------------
# log-transformation
a <- log(ex_data_small)
a$seq.2991.9
b <- log10(ex_data_small)
b$seq.2991.9
isTRUE(all.equal(b, log(ex_data_small, base = 10)))
# floor
c <- floor(ex_data_small)
c$seq.2991.9
# square-root
d <- sqrt(ex_data_small)
d$seq.2991.9
# rounding
e <- round(ex_data_small)
e$seq.2991.9
# inverse log
antilog(1:4)
alog <- antilog(b)
all.equal(ex_data_small, alog) # return `b` -> linear space
# Ops Generics:
# -------------
plus1 <- ex_data_small + 1
times2 <- ex_data_small * 2
sq <- ex_data_small^2
all.equal(sqrt(sq), ex_data_small)
gt100k <- ex_data_small > 100000
gt100k
ex_data_small == ex_data_small # invokes diffAdats()
# Summary Generics:
# -------------
sum(ex_data_small)
any(ex_data_small < 100) # low RFU analytes
sum(ex_data_small < 100) # how many
min(ex_data_small)
min(ex_data_small, 0)
max(ex_data_small)
max(ex_data_small, 1e+7)
range(ex_data_small)