[R] fractional calculations

Stefan Grosse singularitaet at gmx.net
Mon Jun 25 14:08:36 CEST 2007


> is there a function in R that allows me to work with fractions without 
> transforming them to floats (or whatever) in between?
>
>   

You could use the ryacas (CAS) package:
http://code.google.com/p/ryacas/
and/or
http://cran.r-project.org/doc/vignettes/Ryacas/Ryacas.pdf

e.g:
> library(Ryacas)
> yacas(expression((1/2 + 1/8) * 1/2 ))
[1] "Starting Yacas!"
expression(5/16)
>


Stefan

> Something that would calculate something like:
>
> (1/2 + 1/8) * 1/2 = 5/16
>
> without ever transforming to 0.5 and 0.125?
>



More information about the R-help mailing list