[IPython-dev] ipython notebook

Mark Voorhies mark.voorhies at ucsf.edu
Tue Apr 24 14:12:05 EDT 2012

On Monday 23 April 2012 10:56:28 pm Fernando Perez wrote:
> Just today I was talking to a statistician friend and we were
> discussing the possibility of an R notebook frontend.  That's also
> something that would be great to have, and likely very useful.

FWIW, importing rpy within IPython is a pretty useful workflow, particularly
if what you're using from R is high level functions and plotting (the hairy
bit is if you're doing a lot of model fitting, which requires calls to
rpy.set_default_mode to switch among modes for passing objects
between python and R).  IPython.core.display.SVG plays nicely with
RSvgDevice for displaying R generated plots in the notebook.

from IPython.core.display import SVG
import rpy
rpy.r.plot(rpy.r.rnorm(100),rpy.r.rnorm(100), xlab = "x", ylab = "y", main = "")
SVG(filename = "temp.svg")

It _would_ be nice to see how easily the Emacs ESS mode could be ported
to the notebook (the nice features being interactive help in separate buffers
(as with IPython's paging), separate buffers for editing interactively defined
functions (as with %edit), some signal control (as with being able to interrupt
the kernel), and keybindings for some of R's more awkward syntax (e.g., <-).


P.S. I have been teaching for the last two weeks and saving annotated IPython
notebooks from each session.  So far, I've been posting these for the students
as "log -o" python files + landscape-oriented pdf's printed from Firefox (landscape
seems to get around most of the cell truncation issues), but I hope to have some
time this weekend to use these notebooks as a test case for static html export
based on Fernando's script.  (This shouldn't be a blocker on anyone else taking
a crack at the problem -- I suspect that there are several different optima depending
on how WYSIWYG the output should be relative to the browser's vs. IPython's view
of the layout).

More information about the IPython-dev mailing list