| as.poi {rPorta} | R Documentation |
as.poi attempts to turn its argument into a poi object.
as.poi(v)
v |
argument that should be turned into a poi object |
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.
Returns a poi object.
Robin Nunkesser Robin.Nunkesser@tu-dortmund.de
"poi"
# 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))