1

I was trying to embed some r code on a python 2.7 kernel notebook but it doesn't work.

I'm using Anaconda's Jupyter so i've tried :

conda install rpy2

or

conda install rpy2.ipython

Unfortunately anytime I try to use %%R or %R nothing happens except the error message that states that there's no %R magic.

In fact as I try:

%lsmagic

a whole bunch of magic appears except R.

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140

2 Answers2

1

Solution found!

rpy2 package has been moved to rpy2.ipython

therefore to use %%R you must first call

%load_ext rpy2.ipython

instead of

%load_ext rmagic
0

Assuming R is installed, make sure to load the magic before using it:

%load_ext rmagic 
pylang
  • 40,867
  • 14
  • 129
  • 121
  • It is but it still doesn't work. I usually call %load_ext magic in a top cell where i also call all python modules i need. – Adam Viscusi May 08 '18 at 08:15