npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

libr-bridge

v0.1.10

Published

Use libR from node.js

Downloads

5

Readme

libr-bridge

Travis CI

Bridging module: JavaScript < - > R

🄬🌉⬢

Sorry! It's under development.

  • Some important features including S3/S4 object handling and expression are not supported yet!
  • Incompatible API changes may be held.
  • Please do not use in the production environment until specifications are fixed.
  • Pull requests are always welcome.

What is libr-bridge?

libr-bridge is a very powerful npm package which enables you to use R function/statistical method in Node.js environment.

R (The R Foundation, Vienna, Austria) is a free software environment for statistical computing. With libr-bridge, you can use function in R as if they were JavaScript native function.

How to Use

Following samples and libr-bridge are written with ECMAScript 6 modules syntex (import/export). Please use esm or --experimental-modules.

let r = new R();

const arrA = [1.00, 3.36, 8.01, 1.22, 3.74, 2.43, 7.95, 8.32, 7.45, 4.36];
const arrB = [1.04, 3.65, 6.82, 1.46, 2.70, 2.49, 7.48, 8.28, 8.93, 5.63];

/* Some functions are already loaded to libr-bridge */
console.log("Mean of arrA: " + r.mean(arrA));
console.log("Mean of arrB: " + r.mean(arrB));
console.log("Peason's correlation coefficient: " + r.cor(arrA, arrB));

/* You can pass data to R */
r.setVar("a", arrA);

/* And data can be used in R */
console.log(r.eval('sum(a)'));
r.eval('b <- a / 2');
console.log(r.eval('b'));

/* You can receive data from R */
let b = r.getVar("b");

/* Execute complex command with eval. */
r.eval(`
	myfactorial <- function(x) {
		if (x == 0) {
			return(1)
		} else {
			return(x * myfactorial(x - 1))
		}
	}
`);
let factorial_50 = r.func("myfactorial")(50);
console.log(factorial_50);

console.log(r.eval("iris"));

API

Document

Please see doc directory.

Depending package

npm

  1. node-ffi: Node.js Foreign Function Interface
  2. ref * Turn Buffer instances into "pointers"
  3. arian/Complex: Calculations with Complex Numbers in JavaScript

My TODO list

  • [x] Factor
  • [x] Dataframe
  • [x] Console handling
  • [ ] S3 class
  • [ ] S4 class
  • [ ] Graphic handling

Author information

Programmed by kcrt (TAKAHASHI, Kyohei) http://profile.kcrt.net/

License

Copyright © 2017 kcrt (TAKAHASHI, Kyohei)
Released under the MIT license
http://opensource.org/licenses/mit-license.php

Reference

English

  1. R Internals
  2. R internals (by Hadley)
  3. Advanced R by Hadley Wickham
    • You can buy Physical copy of this material. Especially recommended!
  4. Rccp: Seamless R anc C++ Integration
  5. Rcpp documentation
  6. Rcpp for everyone (Masaki E. Tsuda)

Japanese

  1. R入門 Ver.1.7.0
  2. R言語定義 Ver.1.1.0 DRAFT
  3. Rの拡張を書く Ver2.1.0
  4. R言語徹底解説 Hadley Wickham (著), 石田 基広ら (翻訳) 特におすすめです。
  5. みんなのRcpp (Masaki E. Tsuda)