Site icon R-bloggers

Accessing R from Python using RPy2

[This article was first published on Byte Mining, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

This past Tuesday I had the opportunity to present a short talk (a bit long) related to text mining at the Los Angeles R Users’ Group. Since I do most of my text mining in Python, I took this opportunity to discuss RPy2, an interface to R from Python. My slides are below:

Accessing R from Python using RPy2
View more presentations from Ryan Rosario.


Download/view slides here. Topics include

Code for demonstration is here:

  1. offtopic_demo.py is a pure Python script that extracts data from a web forum and dumps it to disk. To actually use it, you will need to register for an account.
  2. RPy2_demo.py reads the data from the forum from disk and calls R from Python to perform some basic analysis.
  3. curljson_demo.R grabs some JSON data from the Twitter Search API using RCurl and converts it to R lists using rjson.

Video:


< embed src="http://blip.tv/play/hoYTgob6UQA%2Em4v" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" height="480" width="450">

Running the code requires some packages that you need to install.

To see the main talk of the evening, click here.

Some Recommended Books

Natural Language Processing

Text Mining

Data Mining

Web Mining

To leave a comment for the author, please follow the link and comment on their blog: Byte Mining.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.