

Combining the power of R and D3.js - tomvangoethem
http://blog.ae.be/combining-the-power-of-r-and-d3-js/?hn

======
currywurst
The culmination of such an approach is realized in the Beaker Notebook
([http://www.beakernotebook.com](http://www.beakernotebook.com)). You can not
only switch between languages, but the environment allows you to share
datasets between Groovy, Python, JS, Julia, Ruby etc ..

It's a work in progress, but something to watch out for, imho

~~~
baldfat
Well this is what iPython is morphing into. iPython is going kernel agnostic
and you can actually use dozens of languages already. Juypter is the new name.

------
minimaxir
Since the post linked to my ggplot2 tutorial, I should probably mention that
I'm really not a fan of interactive charts/D3 for _static_ content, because a)
loading the data can dramatically increase the loading time of the webpage and
b) interactive charts _will_ break on mobile devices, so you need to invest
time to QA that.

Rstudio now offers HTMLWidgets which allow for interactive chart generation
natively, which is interesting:
[http://blog.rstudio.org/2014/12/18/htmlwidgets-javascript-
da...](http://blog.rstudio.org/2014/12/18/htmlwidgets-javascript-data-
visualization-for-r/)

------
RBerenguel
Somewhat close in spirit to what seems like a never-ending side project I
have:
[https://dl.dropboxusercontent.com/u/7702253/AlthingiJS-1.mov](https://dl.dropboxusercontent.com/u/7702253/AlthingiJS-1.mov)
Here I show Javascript and APL, but the plan is to eventually include at the
very least also R. But so far I'm still rewriting what I have until I'm happy
with it, so it's taking ages.

~~~
couchand
That's cool, but... code or it didn't happen. Are you running an APL
interpreter client-side or shuttling the code and data back to the server? If
it's the latter, are you sandboxing in some way the arbitrary code being
executed?

~~~
RBerenguel
Yes, that's the thing. At the current point it is usable (barely) as an
APL/javascript REPL, but there are several corners that are very rough, not
counting unhandled data structures and such. Every time I have some spare time
with some clear mind I work a little on it, so it's not stalled, but has been
going for quite a few months already without much improvement.

As for your question, data goes back to the "server" (there's go code
interacting with the APL interpreter and sanitising inputs and outputs,
converting to JSON, etc) but this is expected to be used as a local service
(using a port not listening to the outside world), so no, no arbitrary code
execution failsafes (if I were to deploy it in some real, server-ed way I'd
isolate interpreters via sessions in the go 'middle' layer).

------
dmichulke
This is why I prefer using clojure + incanter.

You get interactive freechart dialogues (and much more).

Library:
[https://github.com/incanter/incanter](https://github.com/incanter/incanter)

A few (impressive) slides: [http://incanter.org/docs/data-sorcery-
new.pdf](http://incanter.org/docs/data-sorcery-new.pdf)

------
couchand
R is a very powerful tool, but I fail to see how it's adding value in this
case. It seems like the author is advocating just using R to clean up the data
and put it in JSON. The same can be done (without overhead for context
switching and server-client architecture) in JS itself. Tools like Crossfilter
[0] can be seamlessly integrated with D3.

[0]:
[https://square.github.io/crossfilter/](https://square.github.io/crossfilter/)

~~~
baldfat
This is the way I would want my work flow:

1) Use R clean the data

2) Use R to turn the raw data into analytically data

3) Use R to do exploratory charting etc

[Most project stop here]

4) Final Product: RMarkdown (For static reports), Shiny (Interactive variable
charts), or now D3 if I want to have interactive charts. My interactive charts
would be very few.

I wouldn't want to do the first three steps with javascript.

------
sinwave
There is a seemingly dead github repo called "R2D3" by hadley wickham. Wonder
what came of that project?

[https://github.com/hadley/r2d3](https://github.com/hadley/r2d3)

------
IndianAstronaut
I wonder how this will compare to ggvis when it becomes more advanced. Also, I
recommend looking intk Shiny for interactivity.

~~~
baldfat
I have been using ggvis for a little while. It is very flexible in terms of
changing variables for exploratory use. (My favorite personal use). I haven't
done much with Shiny yet but I think D3 is more in lines with RStudio's html
widgets.
[http://rmarkdown.rstudio.com/developer_html_widgets.html](http://rmarkdown.rstudio.com/developer_html_widgets.html)

------
homerowilson
A better approach IMO:

[http://htmlwidgets.org](http://htmlwidgets.org)

