R / Scala
Ruslan Shevchenko!
ruslan@Shevchenko.Kiev.UA!
!
@rssh1 !
https://github.com/rssh
R/Scala interpolation: Why ?
❖ Packages !
❖ for near any thing in statistics exists
appropriative R package. !
❖ Culture!
...
R/Scala: context
ScalaNLP:!
Breeze: + something in REPL
scala-centric point of view
• build environment!
• enhanched REPL ...
R/Scala :context
R is beautiful More like human language than computer!
• 40 years of history!
• parts in C and FORTRAN!
•...
R/JVM
❖ jvmr : !
❖ http://cran.r-project.org/web/packages/jvmr/index.html!
(David B. Dahl )!
❖renjin:!
❖ http://www.renjin...
JVMR
R
JVM
JVM
IPC
Scala interpreter in R
R interpreter in Scala
Simple, just add jar
unmanagedJars in Compile += {	
import scala.sys.process._	
val jarPath = List(“R","--slave","-e",	
""...
JVMR 
Slow, run scala compiler in runtime!
if we want to call scala from R!
!
Integration via ‘string’ representations!
Ve...
RENJIN
❖ R interpeter in JVM!
❖ compiler toolchain for C and FORTRAN parts!
❖ gcj - based.!
❖ work only on linux.!
❖ R pac...
RENJIN
Integration: JSR238 (javax.scripting)
java(scala) objects <=> R objects
Problems:
• Incomplete!
• Sometimes you nee...
Scala/R - import world.
OO - want one banana: !
get all with gorilla behind
If you live in two worlds, this is funny
Thank...
Upcoming SlideShare
Loading in …5
×

R scala 17_05_2014

1,009 views

Published on

Notes about integration of R with scala

Published in: Software, Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,009
On SlideShare
0
From Embeds
0
Number of Embeds
23
Actions
Shares
0
Downloads
9
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

R scala 17_05_2014

  1. 1. R / Scala Ruslan Shevchenko! ruslan@Shevchenko.Kiev.UA! ! @rssh1 ! https://github.com/rssh
  2. 2. 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
  3. 3. 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.
  4. 4. R/Scala :context R 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.
  5. 5. 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)
  6. 6. JVMR R JVM JVM IPC Scala interpreter in R R interpreter in Scala
  7. 7. Simple, just add jar unmanagedJars in Compile += { import scala.sys.process._ val jarPath = List(“R","--slave","-e", """library("jvmr"); cat(.jvmr.jar)”"" ).!!.trim file(jarPath) } !
  8. 8. 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
  9. 9. RENJIN ❖ R interpeter in JVM! ❖ compiler toolchain for C and FORTRAN parts! ❖ gcj - based.! ❖ work only on linux.! ❖ R package with C parts => jar
  10. 10. RENJIN Integration: JSR238 (javax.scripting) java(scala) objects <=> R objects Problems: • Incomplete! • Sometimes you need to look at gcc internals
  11. 11. 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

×