ProductPromotion
Logo

R Programming

made by https://0x3d.site

GitHub - jeroen/V8: Embedded JavaScript Engine for R
Embedded JavaScript Engine for R. Contribute to jeroen/V8 development by creating an account on GitHub.
Visit Site

GitHub - jeroen/V8: Embedded JavaScript Engine for R

GitHub - jeroen/V8: Embedded JavaScript Engine for R

V8

Embedded JavaScript and WebAssembly Engine for R

CRAN_Status_Badge CRAN RStudio mirror downloads

An R interface to V8: Google's open source JavaScript and WebAssembly engine. This package can be compiled either with V8 version 6 and up or NodeJS when built as a shared library.

Getting started

About the R package:

To see some quick examples in R run:

library(V8)
example(v8)

Installation

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

install.packages("V8")

On Linux you need a suitable libv8 installation, see below.

Linux: Static libv8

On amd64/arm64 Linux/MacOS platforms it is possible (and recommended) to automatically download a suitable static build of libv8 during package installation. This is enabled by default on Ubuntu, RHEL, and MacOS. For other systems you can opt-in by setting an environment variable DOWNLOAD_STATIC_LIBV8 during installation, for example:

Sys.setenv(DOWNLOAD_STATIC_LIBV8 = 1)
install.packages("V8")

This way, you can install the R package on any x64 Linux system, without external system requirements. Alternatively, it is also still possible to install libv8 from your distribution as described below. This may be needed for servers running other architectures, or when building the R package without internet access.

Debian / Ubuntu

Installation from source on Linux requires libv8. On Ubuntu / Debian you need to install either libv8-dev, or libnode-dev. On the latest systems, libv8-dev is actually an alias for libnode-dev so they are the same:

# Debian and Ubuntu
sudo apt-get install -y libv8-dev

Fedora / Redhat

On Fedora we need v8-devel (which Fedora provides as part of nodejs):

sudo yum install v8-devel

On CentOS 7 / RHEL 7 we install first need to enable EPEL:

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

On RockyLinux 8 / RHEL 8, v8-devel can be installed from the nodejs:16-epel module repository:

yum --refresh --enablerepo=epel-testing-modular install @nodejs:16-epel/minimal v8-devel

Arch Linux

Arch users are advised to install the v8-r package, which has been configured to work well with R. Installation can done through your preferred AUR helper such as yay, Trizen, etc. However, since V8 contains a large codebase and (re-)compilation takes a while, users may prefer to build and update it manually. For example,

## Arch
cd /tmp
yay -G v8-r   
cd v8-r
makepkg -si

Homebrew

On OS-X use v8 from Homebrew:

brew install v8

But it is much easier to set DOWNLOAD_STATIC_LIBV8 instead.

Hello World

# Create a new context
library(V8)
ctx <- v8()

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

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

Call functions from JavaScript libraries

ctx <- V8::v8()
ctx$source("https://cdnjs.cloudflare.com/ajax/libs/coffee-script/1.4.0/coffee-script.min.js")
jscode <- ctx$call("CoffeeScript.compile", "square = (x) -> x * x", list(bare = TRUE))
ctx$eval(jscode)
ctx$call("square", 9)

More Resources
to explore the angular.

mail [email protected] to add your project or resources here ๐Ÿ”ฅ.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here ๐Ÿ”.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory