Ratio object
Stores the numerator, denominator, and value of a ratio as a single object.
rat(ratio, numerator, denominator, check = TRUE)
ratio,numerator,denominator |
Three objects belonging to the same class. |
check |
Logical. Whether to check that
the objects are |
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
ratio = numerator/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.
An object equivalent to the object ratio
except that it also belongs to the class "rat"
and has additional attributes numerator
and denominator
.
Adrian Baddeley Adrian.Baddeley@curtin.edu.au and Rolf Turner r.turner@auckland.ac.nz.
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.