closure {nexus}R Documentation

Closure Operation

Description

Closes compositions to sum up to 1.

Usage

closure(x, ...)

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

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

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)

[Package nexus version 0.2.0 Index]