totals: Row Sums

totalsR Documentation

Row Sums

Description

Retrieves or defines the row sums (before closure).

Usage

totals(object)

totals(object) <- value

## S4 method for signature 'CompositionMatrix'
totals(object)

## S4 method for signature 'LogRatio'
totals(object)

## S4 replacement method for signature 'CompositionMatrix'
totals(object) <- value

Arguments

object

An object from which to get or set totals.

value

A possible value for the totals of x.

Value

  • totals() <- value returns an object of the same sort as x with the new row sums assigned.

  • totals() returns the row sums of x.

Author(s)

N. Frerebeau

See Also

Other mutators: groups(), mutators

Examples

## Create a count matrix
A1 <- matrix(data = sample(1:100, 100, TRUE), nrow = 20)

## Coerce to compositions
B <- as_composition(A1)

## Row sums are internally stored before coercing to relative frequencies
totals(B)

## This allows to restore the source data
A2 <- as_amounts(B)

## Coerce to a data.frame
X <- data.frame(B)
head(X)

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