HTML C++ R Other
Latest commit b4b9db3 Feb 2, 2017 @jeroenooms Merge pull request #34 from jimhester/master
Try TMPDIR, TMP, TEMP environment variables first


Embedded JavaScript Engine for R

Build Status AppVeyor Build Status Coverage Status CRAN_Status_Badge CRAN RStudio mirror downloads

An R interface to Google's open source JavaScript engine. V8 is written in C++ and implements ECMAScript as specified in ECMA-262, 5th edition. In addition, this package implements typed arrays as specified in ECMA 6 used for high-performance computing and libraries compiled with 'emscripten'.


About the R package:

Hello World

# Create a new context
ctx <- v8()

# Evaluate some code
ctx$eval("var foo = 123")
ctx$eval("var bar = 456")

# Assign / get objects
ctx$assign("foo", JS("function(x){return x*x}"))
ctx$assign("bar", JS("foo(9)"))

Call functions from JavaScript libraries

ctx <- V8::v8()
jscode <- ctx$call("CoffeeScript.compile", "square = (x) -> x * x", list(bare = TRUE))
ctx$call("square", 9)


Binary packages for OS-X or Windows can be installed directly from CRAN:


Installation from source on Linux requires libv8 3.14 or 3.15 (no newer!). On Debian or Ubuntu use libv8-dev:

sudo apt-get install -y libv8-dev

On Fedora we need v8-314-devel:

sudo yum install v8-314-devel

On CentOS / RHEL we install v8-devel via EPEL:

sudo yum install epel-release
sudo yum install v8-devel

On OS-X use v8-315 (not regular v8) from Homebrew versions:

brew tap homebrew/versions
brew install v8-315

On other systems you might need to install libv8 from source. A patched version of V8 3.14 is available from Build instructions are in the build directory.