Created
December 26, 2014 16:50
-
-
Save lgautier/e2e8709776e0e0e93b8d to your computer and use it in GitHub Desktop.
Customization of rpy2 (see comments at https://bitbucket.org/rpy2/rpy2/issue/230/rmagic-specific-conversion)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a setup snippet for an ipython notebook. | |
# It requires the presence of variable 'setup_digest', | |
# defined in the cell controlling the setup. | |
if 'setup_digest' not in locals(): | |
import rpy2 | |
%load_ext rpy2.ipython | |
# pigheaded / slow rpy2 developpers, | |
# customize away: | |
from rpy2.robjects.conversion import ri2py | |
from rpy2.ipython.rmagic import ri2ipython | |
ri2ipython.register(rpy2.robjects.Sexp, ri2py) | |
# HTML rendering of rpy2 objects | |
from rpy2.ipython.html import init_printing, css, HTML | |
init_printing() | |
print('Setup complete (cell below).') | |
else: | |
print('Setup already performed.') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment