closure function

Closure Operation

Closure Operation

Closes compositions to sum to 1. methods

closure(x, ...) ## S4 method for signature 'numeric' closure(x, total = 1, na.rm = TRUE) ## S4 method for signature 'matrix' closure(x, total = 1, na.rm = TRUE)

Arguments

  • x: A numeric vector or matrix.
  • ...: Currently not used.
  • total: A numeric vector specifying the total amount to which the compositions should be closed (defaults to 1).
  • na.rm: A logical scalar: should missing values be removed?

Returns

A numeric vector or matrix (same as x).

Examples

x <- as_composition(c(1, 2, 3)) y <- as_composition(c(1, 2, 1)) ## Perturbation perturbation(x, y) x + y ## Powering powering(y, 2) y * 2 ## Scalar product scalar(x, y)

See Also

Other operations in the simplex: arithmetic, perturbation(), powering(), scalar()

Author(s)

N. Frerebeau