Learn R Programming

spatstat (version 1.55-0)

rat: Ratio object

Description

Stores the numerator, denominator, and value of a ratio as a single object.

Usage

rat(ratio, numerator, denominator, check = TRUE)

Arguments

ratio,numerator,denominator

Three objects belonging to the same class.

check

Logical. Whether to check that the objects are compatible.

Value

An object equivalent to the object ratio except that it also belongs to the class "rat" and has additional attributes numerator and denominator.

Details

The class "rat" is a simple mechanism for keeping track of the numerator and denominator when calculating a ratio. Its main purpose is simply to signal that the object is a ratio.

The function rat creates an object of class "rat" given the numerator, the denominator and the ratio. No calculation is performed; the three objects are simply stored together.

The arguments ratio, numerator, denominator can be objects of any kind. They should belong to the same class. It is assumed that the relationship $$ \mbox{ratio} = \frac{\mbox{numerator}}{\mbox{denominator}} $$ holds in some version of arithmetic. However, no calculation is performed.

By default the algorithm checks whether the three arguments ratio, numerator, denominator are compatible objects, according to compatible.

The result is equivalent to ratio except for the addition of extra information.

See Also

compatible, pool