r scala 17_05_2014

11
R / Scala Ruslan Shevchenko [email protected] @rssh1 https://github.com/rssh

Upload: ruslan-shevchenko

Post on 10-May-2015

366 views

Category:

Software


1 download

DESCRIPTION

Notes about integration of R with scala

TRANSCRIPT

Page 1: R scala 17_05_2014

R / Scala Ruslan [email protected]!!@rssh1 !https://github.com/rssh

Page 2: R scala 17_05_2014

R/Scala interpolation: Why ?❖ Packages !

❖ for near any thing in statistics exists appropriative R package. !

❖ Culture!❖ math-centric community!❖ quick evaluation. !❖ more research than development !

❖ Fun!❖ cross two nontrivial (and very funny)

languages

Page 3: R scala 17_05_2014

R/Scala: context

ScalaNLP:!Breeze: + something in REPL

scala-centric point of view

• build environment!• enhanched REPL + graphics!

• wait until math people switch to one ;)))!• better port only things which will live in

process mode.

Page 4: R scala 17_05_2014

R/Scala :contextR is beautiful More like human language than computer!

• 40 years of history!• parts in C and FORTRAN!• functional, immutability, lazy evaluation!

• antic implementation, crazy conventions !• Object systems:!

• S3, S4, R5, R-proto! All live together ;)R is ugly!

• Slow!• programming ‘in large’ in hard.

Page 5: R scala 17_05_2014

R/JVM

❖ jvmr : !❖ http://cran.r-project.org/web/packages/jvmr/index.html!

(David B. Dahl )!❖renjin:!

❖ http://www.renjin.org/ (BeDataDriven)!❖ fastr: !

❖ https://github.com/allr/fastr (Oracle)

Page 6: R scala 17_05_2014

JVMR

R

JVM

JVM

IPC

Scala interpreter in R

R interpreter in Scala

Page 7: R scala 17_05_2014

Simple, just add jarunmanagedJars in Compile += { import scala.sys.process._ val jarPath = List(“R","--slave","-e", """library("jvmr"); cat(.jvmr.jar)”"" ).!!.trim file(jarPath)}!

Page 8: R scala 17_05_2014

JVMR 

Slow, run scala compiler in runtime! if we want to call scala from R!

!Integration via ‘string’ representations!

Very simple, in many cases it’s enough!!

‘native’ R

Page 9: R scala 17_05_2014

RENJIN

❖ R interpeter in JVM!❖ compiler toolchain for C and FORTRAN parts!

❖ gcj - based.!❖ work only on linux.!❖ R package with C parts => jar

Page 10: R scala 17_05_2014

RENJINIntegration: JSR238 (javax.scripting)

java(scala) objects <=> R objects

Problems:• Incomplete!• Sometimes you need to look at gcc internals

Page 11: R scala 17_05_2014

Scala/R - import world.OO - want one banana: ! get all with gorilla behind

If you live in two worlds, this is funny

Thanks for attention