Rmagic, A Handy Interface Bridging Python and R

Yet Another Blog in Statistical Computing

Rmagic (http://ipython.org/ipython-doc/dev/config/extensions/rmagic.html) is the ipython extension that utilizes rpy2 in the back-end and provides a convenient interface accessing R from ipython. Compared with the generic use of rpy2, the rmagic extension allows users to exchange objects between ipython and R in a more flexible way and to run a single R function or a block of R code conveniently.

Below is an example demonstrating a simple use case how to push a pandas DataFrame object into R, convert it to a R data.frame, and then transfer back to a new pandas DataFrame object again.

View original post


About dmvianna

Past neuroscientist, now data analyst.
This entry was posted in Uncategorized. Bookmark the permalink.

3 Responses to Rmagic, A Handy Interface Bridging Python and R

  1. laviniag says:

    Hi Daniel, this comment is actually in relation to a Dec 6th post on “speed up map plotting” but wordpress wouldn’t let me comment there so I am trying here:

    “Very nice post. Could you put a link to the actual census data that you used?, I am trying to do something similar and am parsing something incorrectly to ggplot but am not sure what! Thanks.

    • dmvianna says:

      Hi, Lavinia.

      Indeed, my initial intention was indeed to post a link, but ABS requires users to register before giving them access to the census data. Registering is free. The data I used was from their data pack product. I downloaded the topmost leftmost option in their datapacks download page (which you see after loggin in), and after unzipping it I used the exact directory structure and filenames as provided, so the example would be reproducible.

      I hope these instructions will be enough for you to reproduce my example, let me know if you need more help.

      Cheers, Daniel.

      P.S: The URL for the Data Packs is below, WordPress is not rendering HTML properly in my comment:


  2. Pingback: Rmagic, A Handy Interface Bridging Python and R - R Project Aggregate

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s