Learning R

R is a programming language and software for statistical computing and graphics. It is the most popular tool for statisticians and a widely used software for statistical data analysis thanks to the fact that its source code is freely available and it is fairly easy to access from installation to theoretical application.

Most of information about R can be found at R Project including the software itself and many add-on packages. These individually contributed packages serve particular statistical interests of their users. The documentation menu on the website and each packages contain extensive documentations of how-to’s. Some large packages include demos so that following the scripts in a demo makes R learning easy.

For astronomers, the R tutorial from Penn State Summer School for Astronomers will be useful. This tutorial illustrates R with astronomical data sets. Copy-and-pasting command lines will be a good starting point until data structures and programming logics become internalized. R is a fairly simple language to learn if one has a little experience in other programming languages.

A good online tutorial, providing an overview of R, is found from this link. Many user’s interest dependent tutorials available on line. Here are sample images from Taeyoung’s Tutorial (click for pdf).


Among many available textbooks, the followings provide general R usage. More books are available for specific needs.

Also, Introduction to the R Project for Statistical Computing for use at ITC (click for pdf) by D.G. Rossiter provides a short but extensive overview of R.Unfortunately, FITS reader is not available in R. We hope a skillful astronomer to contribute a FITS reader among other packages.

  1. pef:

    pef said…

    I have developed a prototype package which
    I call RFITS which is simply an R wrapper around CFITSIO. At some point I will make it available, at least to interested readers of this group.

    05-03-2007, 10:08 am
  2. hlee:

    I tried RFITS. Unfortunately, at this moment, I couldn’t make it run because my R is running on a 64 bit machine. Once it works, it’ll be very useful for both astronomers and statisticians, particularly the latter who wish to try their statistics to new data sets.

    05-30-2007, 5:45 pm
  3. hlee:

    Books on R (click)

    06-05-2007, 11:11 am
  4. hlee:

    A Quick, Painless Tutorial and Reference on the R Statistical Package (Click)

    06-13-2007, 6:11 pm
  5. Fran:

    Hey pef, I was trying to find a FITS reader for R, and the only effort that I could find in Google was yours. I was going to write it myself, but since you already have it, would you mind sharing it? I could testdrive it, improve it (if needed) and eventually it could be submitted to CRAN, or to the authors of the foreing package.


    11-22-2007, 7:14 am
  6. pef:


    Sorry for the late response; I have been completely focused on finishing off my stats class.

    Vinay offered to host it on the CHASC page; I will send him a tarball “real soon now.” It is
    pretty bare-bones but has at least basic image and binary table read-in capabilities.


    12-13-2007, 2:10 pm
  7. pef:


    The time dubbed “real soon now” has arrived: it has been sent to Vinay to be included on the
    CHASC page. If you alter it, please let me know so I can try to incorporate changes into my
    base code…


    12-13-2007, 2:31 pm
  8. vlk:

    I have put Peter’s R-FITS package at http://hea-www.harvard.edu/AstroStat/rfits/

    12-13-2007, 3:12 pm
  9. Fran:

    Wow, I checked this too late :-)

    I’ll start trying it ASAP.


    12-19-2007, 10:30 am
  10. hlee:

    From the New York Times: Data Analysts Captivated by R’s Power

    01-07-2009, 9:05 pm
Leave a comment

Be advised that your thoughtful comment may not be submitted if too much time is spent. For a long comment, use an editor and copy the content into the box below. If unexpected submission denial happens, go back, copy the content, refresh the browser, paste the content, and then submit.

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>