Generic functions and methods for S3 class english

Description

The functions as.english and english are fully equivalent generic constructor functions for the S3 class english, which allows numeric objects to be represented in the form of their customary English expression.

Usage

1
2
3
4
5
6
7
8
as.english(x, ...)
english(x, ...)
## S3 method for class 'numeric'
english(x, ...)
## S3 method for class 'english'
english(x, ...)
## Default S3 method:
english(x, ...)

Arguments

x

Any numeric object. If the components are not integers, they are rounded. In the case of english.default this may be an object of any class, but will always result in an error.

...

Currently unused.

Details

The function english is a generic constructor function for objects of class english. The methods either mark the object as having the appropriate class, or, in the case of english.default, result in an error message. The function as.english is provided as a corresponding function to as.roman in the utils package. The method english.english simply allows the constructor function to act as a coercion and to have no effect on objects already of the class.

Value

An object of class english, if possible, or an error message if not.

Author(s)

Bill Venables

References

See original note by John Fox at http://tolstoy.newcastle.edu.au/R/help/05/04/2715.html.

See Also

as.character.english, print.english.

Examples

1
as.english(10001001) + (-5):5