Apply Function for NMF Objects
The function nmfApply
provides exteneded
apply
-like functionality for objects of class
NMF
. It enables to easily apply a function over
different margins of NMF models.
nmfApply(X, MARGIN, FUN, ..., simplify = TRUE, USE.NAMES = TRUE)
X |
an object that has suitable |
MARGIN |
a single numeric (integer) value that
specifies over which margin(s) the function |
FUN |
a function to apply over the specified margins. |
... |
extra arguments passed to |
simplify |
a logical only used when |
USE.NAMES |
a logical only used when
|
apply FUN
to each
row of the basis matrix: apply(basis(X), 1L,
FUN, ...)
.
apply FUN
to each column
of the coefficient matrix: apply(coef(X), 2L, FUN,
...)
.
apply FUN
to each pair of
associated basis component and basis profile: more or
less sapply(seq(nbasis(X)), function(i, ...)
FUN(basis(X)[,i], coef(X)[i, ], ...), ...)
.
In this case FUN
must be have at least two
arguments, to which are passed each basis components and
basis profiles respectively – as numeric vectors.
apply FUN
to each column
of the basis matrix, i.e. to each basis component:
apply(basis(X), 2L, FUN, ...)
.
apply FUN
to each row of
the coefficient matrix: apply(coef(X), 1L, FUN,
...)
.
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.