Download - R scala 17_05_2014
R / Scala Ruslan [email protected]!!@rssh1 !https://github.com/rssh
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
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.
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.
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)
JVMR
R
JVM
JVM
IPC
Scala interpreter in R
R interpreter in Scala
Simple, just add jarunmanagedJars in Compile += { import scala.sys.process._ val jarPath = List(“R","--slave","-e", """library("jvmr"); cat(.jvmr.jar)”"" ).!!.trim file(jarPath)}!
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
RENJIN
❖ R interpeter in JVM!❖ compiler toolchain for C and FORTRAN parts!
❖ gcj - based.!❖ work only on linux.!❖ R package with C parts => jar
RENJINIntegration: JSR238 (javax.scripting)
java(scala) objects <=> R objects
Problems:• Incomplete!• Sometimes you need to look at gcc internals
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