Skip to content Skip to navigation
University of Warwick
  • Study
  • |
  • Research
  • |
  • Business
  • |
  • Alumni
  • |
  • News
  • |
  • About
  • Text only
  • |
  • Sign in
  • Search MOAC
  • Search University of Warwick
  • Search for people at Warwick
  • Search Warwick Blogs
  • Search past exam papers
  • Search video
  • More…

    Molecular Organisation and Assembly in Cells

    • About the DTC
    • Research
    • People
    • Degrees
    • Study at MOAC
    • News & Events
    • MOAC Students »
    • Peter Cock »
    • R Programming »
    • R and Python
    University of Warwick

    Combining R and Python

    Personally I find Python to be a great general purpose cross platform language (see my Python Pages). However, R has its strengths too, particularly in statistics and graphics.

    Calling R from Python

    R's rich libraries for statistics and graph creation can be called from within a Python program using RPy (R from Python), written by Walter Moreira and Gregory Warnes. It works on both Linux and Windows.

    I have used this to:

    • Calculate linear regressions
    • As one of several ways to calculate rank correlations.
    • Draw heatmaps from Python
    • Draw Ramachandran Plots from Python, using filled contour plots with an overlayed scatter plot described here in just R.
    • Draing protein contact maps, another contour plot example.

    See my python pages for further examples...

    Calling Python from R

    This should be possible using RSPython, an R/SPlus - Python Interface. I have not tried this yet, mainly because of their weak Windows support. On linux at least, RSPython should allow you to call R from Python, and Python from R - which makes it rather more powerful than RPy.

    [R logo]
    The R Project

     

    [Python logo]
    Python

     

    [RPy logo]
    RPy (R from Python)

    MOAC DTC, Coventry House, University of Warwick, Gibbet Hill Road, Coventry, CV4 7AL
    Tel. 024 765 75808 moac2 at warwick dot ac dot uk

    How to find us

    MOAC Intranet

    EPSRC logo

    Close this email form
    Page contact: Peter Cock Last revised: Sat 28 Apr 2007
    • Sign in
    • |
    • Powered by Sitebuilder
    • |
    • © MMXII
    • |
    • Privacy
    • |
    • Accessibility