Learn R Programming

compositions (version 1.40-2)

totals: Total sum of amounts

Description

Calculates the total amount by summing the individual parts.

Usage

totals(x,…)
# S3 method for acomp
totals(x,…,missing.ok=TRUE)
# S3 method for rcomp
totals(x,…,missing.ok=TRUE)
# S3 method for aplus
totals(x,…,missing.ok=TRUE)
# S3 method for rplus
totals(x,…,missing.ok=TRUE)
# S3 method for ccomp
totals(x,…,missing.ok=TRUE)

Arguments

x

an amount/amount dataset

not used, only here for generic purposes

missing.ok

if TRUE ignores missings; if FALSE issues an error if the total cannot be calculated due to missings.

Value

a numeric vector of length equal to ncol(x) containing the total amounts

Missing Policy

if missing.ok=TRUE missings are just regarded as 0, if missing.ok=FALSE WZERO values is still regarded as 0 and other sorts lead to NA in the respective totals.

See Also

aplus

Examples

Run this code
# NOT RUN {
data(SimulatedAmounts)
totals(acomp(sa.lognormals))
totals(rcomp(sa.lognormals,total=100))
totals(aplus(sa.lognormals))
totals(rplus(sa.lognormals))
aplus(acomp(sa.lognormals),total=totals(aplus(sa.lognormals)))


# }

Run the code above in your browser using DataLab