Learn R Programming

farsi (version 1.0)

as.farsi: Generic functions and methods for S3 class persian

Description

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

Usage

as.farsi(x, ...) farsi(x, ...) "farsi"(x, ...) "farsi"(x, ...) "farsi"(x, ...)

Arguments

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

Value

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

Details

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

References

See original note by Sadegh Rasoulinejad at

See Also

as.character.farsi, print.farsi.

Examples

Run this code
as.farsi(10001001) + (-5):5

Run the code above in your browser using DataLab