as_composition | R Documentation |
Coerces an object to a CompositionMatrix
object.
as_composition(from, ...)
## S4 method for signature 'numeric'
as_composition(from)
## S4 method for signature 'matrix'
as_composition(from)
## S4 method for signature 'data.frame'
as_composition(
from,
parts = NULL,
groups = NULL,
verbose = getOption("nexus.verbose")
)
from |
A |
... |
Currently not used. |
parts |
A |
groups |
An |
verbose |
A |
See vignette("nexus")
.
A CompositionMatrix
object.
N. Frerebeau
Other compositional data tools:
as_amounts()
## Create a count matrix
A1 <- matrix(data = sample(1:100, 100, TRUE), nrow = 20)
## Coerce to compositions
B <- as_composition(A1)
## Row sums are internally stored before coercing to relative frequencies
totals(B)
## This allows to restore the source data
A2 <- as_amounts(B)
## Coerce to a data.frame
X <- data.frame(B)
head(X)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.