Skip to content

Instantly share code, notes, and snippets.

@andrewschaaf
Created April 23, 2011 20:16
Show Gist options
  • Save andrewschaaf/938934 to your computer and use it in GitHub Desktop.
Save andrewschaaf/938934 to your computer and use it in GitHub Desktop.
{spawn} = require 'child_process'
bin = "/Library/Frameworks/R.framework/Versions/2.13/Resources/R"
code = """
x1 <- matrix(rnorm(1e4), ncol=2)
x2 <- matrix(rnorm(1e4, mean=3, sd=1.5), ncol=2)
x <- rbind(x1,x2)
plot(x)
"""
p = spawn bin, ['--vanilla', '--silent', '-e', code]
p.on 'exit', (code) ->
console.log "Exited with code #{code}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment