View source: R/compositional_ops.R
| powering | R Documentation |
The powering operation raises each part of a composition to a scalar exponent and then applies closure to re-normalize the result as a composition.
powering(X, alpha)
X |
A numeric vector, matrix or data.frame containing compositions. |
alpha |
A numeric scalar or vector. If |
Powering is the analogue of scalar multiplication in the simplex. Each part
is raised to alpha, and the result is closed with closure.
When alpha has one value per row, each composition is powered by its
corresponding value. When it has one value per part, each part receives its
corresponding exponent. For vector X and vector alpha, each row
of the result is X powered by the corresponding element of
alpha.
An object with the same format as X containing the powered
compositions, except that vector X with vector alpha returns
a matrix.
x <- c(a = 1, b = 2, c = 3)
powering(x, 2)
powering(x, c(1, 2))
X <- rbind(
c(1, 2, 3),
c(4, 5, 6)
)
powering(X, c(1, 2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.