View source: R/sumComposition.R
sumComposition | R Documentation |
Compute percentage or proportion of elements in a composition.
sumComposition(x, ..., Range = 100)
x |
any numeric vector, matrix, or data frame containing only numeric columns. |
... |
any additional vectors or matrices. |
Range |
the output range, generally 100 for percentages (the default) or 1 for proportions. |
Missing values are permitted in x
or ...
and result in missing
values for the row in the output.
A matrix with columns matching all of the data in x
and
...{}
with rows summing to Range
.
This function is designed to meet a very simple need in some
applications like constructing data for Piper (Piper, 1944) or trilinear diagrams.
For more in-depth manipulations of compositional data, the user is directed
to the compositions
or other similar package.
Piper, A.M., 1944, A graphical procedure in the geochemical interpretation of water analyses: Transactions of the American Geophysical Union, v. 25, p. 914-923.
# Create tiny dataset TinyCations <- data.frame(Ca=c(32, 47, 28), Mg=c(10,12,15), Na=c(7, 5, 7)) sumComposition(TinyCations)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.