README.md

rpn: Reverse Polish Notation Interpreter

CRAN Status Badge CRAN Downloads Build Status Build status Coverage Status

Info: TravisCI build fails on Linux due to strange errors which are unrelated to R and the package itself.

Description

This R package contains a method single method rpn to transform expressions in (reverse) polish notation to infix notation.

# simple example
r = c("4", "6", "*", "6", "+")
rpn(r)
rpn(r, eval = FALSE)

# the same example but with a variable
r = c("x", "6", "*", "6", "+")
rpn(r, eval = TRUE, vars = list(x = 4))
rpn(r, eval = FALSE)

# now a more complex expression with variables and custom operators/functions
rpe = c("x", "5", "6.4", "mysum", "5", "mystuff")
mysum = function(x, y, z) x + y + z # arity 3 and no infix operation
mystuff = function(x, y) 2 * (x + y) # arity 2 and no infix operation
ops = list(mysum = list(3, FALSE, mysum), mystuff = list(2, FALSE, mystuff))
vars = list(x = 3.6)
rpn(rpe, ops = ops, vars = vars)

Installation Instructions

You can download the package from CRAN. If you are interested in trying out and playing around with the current github developer version use the devtools package and type the following command in R:

devtools::install_github("jakobbossek/rpn")

Contact

Please address questions and missing features about the rpn package to the author Jakob Bossek j.bossek@gmail.com. Found some nasty bugs? Please use the issue tracker for this. Pay attention to explain the problem as good as possible. At its best you provide an example, so I can reproduce your problem.



jakobbossek/rpn documentation built on May 18, 2019, 10:11 a.m.