<div dir="ltr"><div><div>Chris,<br><br></div>Using method_missing, as you did, is exactly the way I've implemented SciCom (Ruby with Renjin) and plan to work in SciCom2 (Ruby with FastR). With method_missing we can encapsulate R inside Ruby and there is no need to use multiple files, for Ruby and R, almost everything can be done in Ruby transparently. <br><br></div><div>This is an example of SciCom (plain Ruby with R method calls encapsulate in the R module):<code><br><br>====<br><font size="4">require 'scicom'</font></code><font size="4"><code>
</code></font><code></code><pre><font size="4"><code># This dataset comes from Baseball-Reference.com.
baseball = R.read__csv("baseball.csv")<br><br># Lets look at the data available for Momeyball.
moneyball = R.subset(baseball, baseball.Year < 2002)
# Let's see if we can predict the number of wins, by looking at
# runs allowed (RA) and runs scored (RS). RD is the runs difference.
# We are making a linear model for predicting wins (W) based on RD
moneyball.RD = moneyball.RS - moneyball.RA
wins_reg = R.lm("W ~ RD", data: moneyball)
R.summary(wins_reg).pp</code></font></pre>===<br><br></div><div>As another example, here is a SciCom script to print the number of
days for every month is 2005:<br></div><div><pre><font size="4"><code>===<br>require ‘scicom’<br><br>everyday = R.seq(from: R.as__Date('2005-1-1'), to: R.as__Date('2005-12-31'), by: 'day')
cmonth = everyday.format('%b')
cmonth
.factor(levels: cmonth.unique, ordered: TRUE)
.table
.pp
</code></font></pre>===<br><br>See here that we can chain methods in usual Ruby way. I think this is much more readable than the R chaining %>% construct.<br></div><div><br><br>More information on SciCom - <a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_rbotafogo_scicom_wiki&d=DwMFaQ&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=CUkXBxBNT_D5N6HMJ5T9Z6rmvNKYsqupcbk72K0lcoQ&m=93M0andXobSZh5VFKbn8JPc7LTMwaih8B1PXYnq3R70&s=JAOYh695J_ZKLiUpp0W21jD54KP15iQR0G9uFHiSsBE&e=">https://github.com/rbotafogo/scicom/wiki</a><br><br></div><div><br></div>Thanks for your help!<br><br><br></div>