as.poi {rPorta}R Documentation

Coerce to poi object

Description

as.poi attempts to turn its argument into a poi object.

Usage

as.poi(v)

Arguments

v argument that should be turned into a poi object

Details

Matrices with numeric values are transformed to rational values. This is done in a way that assumes that the numeric values in v represent rational values, e.g. as.poi(0.8)=4/5, but as.poi(1/3)=333333333/1e+09. For exact transformation, one possibility is to use the R package gmp, which gives the exact rational values, e.g.
as.bigq(0.8)=3602879701896397/4503599627370496
as.bigq(1/3)=6004799503160661/18014398509481984
as represented by the computer.

as.poi also transforms strings like "1/3" to poi objects.

Value

Returns a poi object.

Author(s)

Robin Nunkesser Robin.Nunkesser@tu-dortmund.de

See Also

"poi"

Examples

# Convert the numeric value 0.8 to a poi object
as.poi(0.8)

# Convert the character value "1/3" to a poi object
as.poi("1/3")

# Convert a matrix to a poi object
as.poi(matrix(1:16/4,ncol=4))

[Package rPorta version 0.1-9 Index]