Recently I’ve been working with some of the statistics staff at the University of Manchester on sports analytics. Specifically we’ve been looking for useful models in football data. People from this background normally use R to analyze data and fit models.
Normally I would use Python for this kind of task but, since there was already a considerable amount of code in R, it made sense for me to do some work in R. The people at Continuum Analytics (who make the brilliant Anaconda Python distribution) recently announced support for R using their package manager conda. However, it wasn’t easy to find instructions to get a fully working environment, so here is what I did.
Note: I am assuming that you are using Linux (probably works on Mac too) but I make no guarantees whatsoever that following this will get you a working environment!
You can enter the following into a Bash prompt.
# Create a new conda environment called r conda create -n r anaconda # Switch to r environment source activate r # Installs R conda install -c r r # Install R kernel for IPython notebook conda install -c r r-irkernel # Install ggplot conda install -c https://conda.binstar.org/bokeh ggplot # Install r-matrix, r-nlme, and some other useful libraries. # This may raise an error but I haven't encountered any problems conda install -c https://conda.binstar.org/asmeurer r-nlme # Install lme4 (linear mixed models) conda install -c https://conda.binstar.org/asmeurer r-lme4
You can now start up a Jupyter notebook, which is preinstalled with the R kernel, and start using R as follows.