/ R-Project

Giving your R code a boost with NodeJS modules. Power up your OpenCPU!

I've am a happy node user and would like to use the power of node modules in R!
Sounds crazy? V8 to the rescue!

I'll expand on this soon ... but this a quick note and a whole lot of fun!

Create a browserified version of the module

echo "global.moment = require('moment-timezone');" > moment_in_beauty.js
browserify moment_in_beauty.js -o moment_out_beauty.js

Load it up in R using V8!

ct <- v8()
ct$source(system.file("js/moment_out_beauty.js", package="Rdalalbeat"))
var jun = moment("2014-06-01T12:00:00Z");
var out = jun.tz('America/Los_Angeles').format('ha z');  // 5am PDT

More on this soon!