Coerce to Amounts
Arguments
- from
A CompositionMatrix object.
- ...
Currently not used.
See also
Other compositional data tools:
as_composition()
,
closure()
Examples
## Create a count matrix
A1 <- matrix(data = as.numeric(sample(1:100, 100, TRUE)), nrow = 20)
## Coerce to compositions
B <- as_composition(A1)
## Row sums are internally stored before coercing to relative frequencies
## (use get_totals() to retrieve these values)
## This allows to restore the source data
A2 <- as_amounts(B)
## Coerce to an S3 data.frame
X <- data.frame(B)
head(X)
#> col1 col2 col3 col4 col5 samples
#> row1 0.2179487 0.01282051 0.08974359 0.09615385 0.5833333 row1
#> row2 0.3892216 0.02994012 0.13173653 0.07784431 0.3712575 row2
#> row3 0.2554348 0.03260870 0.19293478 0.27173913 0.2472826 row3
#> row4 0.1983914 0.10187668 0.25201072 0.19839142 0.2493298 row4
#> row5 0.3318182 0.10454545 0.40454545 0.03636364 0.1227273 row5
#> row6 0.2474227 0.05841924 0.22680412 0.27835052 0.1890034 row6