I am trying to recreate the demo examples on the IPython Notebook rmagic page. I am getting partial success with a specific error that comes up every time I try to use %Rpush or try to exchange data between R and numpy via the Rpush and Rpull mechanisms (which push/pull data between R and the Py namespaces )
%%R cell magic works reasonably well – I am able to define R vecs X and Y and do a print (lm(X~Y)) which successfully prints output in an IPython Notebook. This also works identically on the qtconsole, and the terminal.
Now if I do a plot(X,Y) inside the cell – I successfully get a plot.
If I start a new Notebook line and try plot(X,Y) I get the following error
[....]
TypeError: coercing to Unicode: need string or buffer, dict found
full stack trace at http://pastebin.com/Pb56Tmgc
a) Why is this successful inside a cell but not working in a line?
b) Any suggestions?
(Env: Python 2.7 (Anaconda 2.7.3 CE) R 2.15 rpy2 2.3 MacOSX 10.7.5 on a 2010 MBP 15″
http://www.soundfrost.org/ >youtube to mp3
This is a bug – the R magic was getting the local namespace as the argument where it was expecting the cell.
Digging into
IPython.core.interactiveshellwithgit blame, it looks like it was fixed as part of pull request #2130 a few months ago.