closure: Closure Operation

closureR Documentation

Closure Operation

Description

Closes compositions to sum to 1.

Usage

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?

Value

A numeric vector or matrix (same as x).

Author(s)

N. Frerebeau

See Also

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

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)

nexus documentation built on Sept. 11, 2024, 6:43 p.m.