Analyzing data with the R programming language in the IPython notebook
R (www.r-project.org) is a free domain-specific programming language for statistics. Its syntax is well-adapted to statistical modeling and data analysis. By contrast, Python's syntax is typically more convenient for general-purpose programming. Luckily, IPython allows you to have the best of both worlds. For example, you can insert R code snippets anywhere in a normal IPython notebook. You can continue using Python and pandas for data loading and wrangling, and switch to R to design and fit statistical models. Using R instead of Python for these tasks is more than a matter of programming syntax; R comes with an impressive statistical toolbox that is still unmatched by Python.
In this recipe, we will show how to use R from IPython, and we illustrate the most basic capabilities of R with a simple data analysis example.
Getting ready
You need the statsmodels package for this recipe. You can find installation instructions in...