yihui / runr

Run external programs from R (experimental)
87 stars 26 forks source link

Possible solution to running javascript inside R/knitr #11

Open yixuan opened 9 years ago

yixuan commented 9 years ago

Just found the V8 package that could run javascript code inside R.

yihui commented 9 years ago

Pull requests welcome :)

Here is what I'd do if I were to add this feature:

  1. Use ct$validate() to group lines of JS code into minimal complete blocks (similar idea to https://github.com/yihui/highr/blob/master/R/utils.R#L8-L23);
  2. ct$eval() code blocks one by one, and collect output;
  3. knitr:::wrap() the list of source code and output created from the previous step.