One of the foundational principles of the web, though I suspect ever fewer people know it, is that you can “View Source” on a web page to see what bits of HTML, Javascript and CSS are used to create it.
In the WordPress editor I’m currently writing in, I’m using a Text view that lets me write vanilla HTML; but there is also a WYSIWYG (what you see is what you get) view that shows how the interpreted HTML text will look when it is rendered in the browser as a web page.
Reflecting on IPython Markdown Opportunities in IPython Notebooks and Rstudio, it struck me that the Rmd (Rmarkdown) view used in RStudio, the HTML preview of “executed” Rmd documents generated from Rmd by knitr and the interactive Jupyter (IPython, as was) notebook view can be seen as standing in this sort of relation to each other:
From that, it’s not too hard to imagine RStudio offering the following sort of RStudio/IPython notebook hybrid interface – with an Rmd “text” view, and with a notebook “visual” view (eg via an R notebook kernel):
And from both, we can generate the static HTML preview view.
In terms of underlying machinery, I guess we could have something like this:
I’m looking forward to it:-)
Are you familiar with the “editR” package? i haven’t used it much but when i have it seemed like a pretty useful live HTML previewer for Rmd docs. Not exactly the same as what you outline here, but similar…
Ooh – no, that looks interesting… So you author in Rmd and it does a live view of the executed output in the View pane?
I need to take a tim-out. Can;’t quite get my head round what each of these different models affords… But certainly seems that there’s now a variety of ways of doing literate programming where you get a live view of code output?
I believe it pops up a new browser window entirely, then as you edit the file it live-updates. Again, I don’t have much experience with it; it just rang a bell when compared to what you were describing.
You might like thebe: https://github.com/oreillymedia/thebe https://oreillymedia.github.io/thebe/examples/t-sne-build.html
@jan Thanks for all these… I guess a need to do a review of all the various approaches for myself to get a proper feel for the how they compare – and differ – in what they offer. (Unless you happen to know of such an review available elsewhere, of course?!)
Another potentially useful nugget for the mix: R Markdown to IPython Notebook
I’m not totally clear on the the distinctions between notedown, which this solution depends on, and the seemingly similar ipymd. ipymd looks like a larger project which also has the goal of making a round-trip journey from md to ipymd.
@ethan ah – thanks for that. I need to lay all this stuff out on the floor and then try to pull it back together in some sort of comparative framework to try to make sense of it and perhaps see where the gaps are, or missing conversion paths, if anyway. Not sure what such a thing would look like though!
To try out Jupyter notebooks with a native R-kernel, the easiest way is probably to use a prebuilt docker container. Possible dockerfiles below:
The easiest way of running docker containers is probably kitematic. At the time of writing, the Windows version of kitematic is in (request only?) alpha, but their pace of development seems to be such that it should be publicly available sometime soon…