$ 0 0 It looks pretty straightforward to adapt one of the examples in the documentation as a starting point to your R code, and previous discussions about calling (source) R code from file are available.