totals {nexus}R Documentation

Row Sums

Description

Retrieves or defines the row sums (before closure).

Usage

get_totals(x)

set_totals(x) <- value

## S4 method for signature 'CompositionMatrix'
get_totals(x)

## S4 replacement method for signature 'CompositionMatrix'
set_totals(x) <- value

Arguments

x

An object from which to get or set totals.

value

A possible value for the totals of x.

Value

Author(s)

N. Frerebeau

See Also

Other mutators: groups, identifiers, samples, split(), subset()

Examples

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

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

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

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

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

[Package nexus version 0.2.0 Index]