How do I run %%magic in R inside Jupyter?
%%javascript
IPython.OutputArea.auto_scroll_threshold = 99999;
The auto scroll feature on longer output is vastly annoying as I have several functions and scripts that spit out a lot of output.
The above Javascript works fine in python notebooks but not in R notebooks.
When I run the %% magic command in R, it barfs:
Error in parse(text = x, srcfile = src): <text>:1:1: unexpected SPECIAL
1: %%
Any suggestions?
According to this post disable_autoscroll.py, it may be possible to put that Javascript into a profile_dir/static/js/custom.js file. Pray tell, where is the profile_dir on a Windows box?
I found: c:/Anaconda2/Lib/site-packages/notebook/static/custom/custom.js
but that is the central custom.js file.
References:
Auto-scrolling of long output should be configurable in the UI
In my anaconda install of the notebook, the custom.js
file is in %USERPROFILE%\.jupyter\custom\custom.js
.
For the "magics": magics are a thing of the python kernel, not the notebook. The R kernel does not implement a magic system and so these don't work. As mentioned above, use IRdisplay::display_javascript('IPython.OutputArea.auto_scroll_threshold = 99999;')
for your usecase.