Search code examples
rfractions

Print number as reduced fraction in R


On my old beat-up TI-83 I can get a reduced fraction representation of a rational real number with the following syntax.

.14>Frac
               7/50

Is there a similar syntax, function, or CRAN package that will allow me to do this in R?


Solution

  • fractions() in the MASS package does just that:

    > library(MASS)
    > fractions(.14)
    [1] 7/50