Introduction to R

Tuesday 6th Sept at 14:00-17:00

No prior experience with R and RStudio is required for this session, however you are required to do three things before you attend :-
  1. Download R for your platform from the R Project website, install it, and verify that it starts.
  2. Download R Studio for your platform from the R Studio website, install it, and verfy that it starts too.
  3. Download 'A very short introduction to R' from CRAN, read it, and work through it.

What we expect you to be able to do after this session is :-

  • Start R Studio and set up a project
  • Understand what an R package is and how to install and load them
  • Load a simple data file
  • Understand how (and why) R uses dataframes and vectors
  • Use the R help system
  • Examine a dataframe
  • Prepare simple tables
  • Produce good quality graphs, and save these
  • Locate and perform some elementary statistical tests on your data
  • Prepare a simple function
  • Prepare and run R script files

Key files

Please download these files, and put them in a new directory. Make sure you know where they are. You will need to be able to find them again. The pdf file is a record of the whole session.

Create a sub-directory called 'data' in the same directory, and save these two files into that.
If you have a data file of your own to work on, place it in the same directory as these two files.

Open the first file in RStudio. This should set up a project, which you can easily access later.



  1. Altman N, Krzywinski M. Points of significance: Sources of variation. Nat Methods 2015 12(1):5-6.
  2. Colquhoun D. An investigation of the false discovery rate and the misinterpretation of p-values. R Soc Open Sci. 2014 Nov 19;1(3):140216. doi: 10.1098/rsos.140216.
  3. Cumming G, Fidler F, Vaux DL. Error bars in experimental biology. J Cell Biol. 2007 9;177(1):7-11.
  4. Gelman A. P values and statistical practice. Epidemiology 2013 24(1):69-72. doi: 10.1097/EDE.0b013e31827886f7
  5. Krzywinski M, Altman N. Points of significance: error bars. Nat Methods 2013 10(10):921-2. doi: 10.1038/nmeth.2659
  6. Krzywinski M, Altman N. Points of significance: Importance of being uncertain. Nature Methods 10(9):809-10 2013 doi: 10.1038/nmeth.2613
  7. Krzywinski M, Altman N. Visualizing samples with box plots. Nat Methods 2014 11(2):119-20.
  8. Leek JT, Peng RD. Opinion: Reproducible research can still be wrong: adopting a prevention approach. Proc Natl Acad Sci U S A. 2015 112(6):1645-6. doi: 10.1073/pnas.1421412111
  9. Leek JT, Peng RD. Statistics: P values are just the tip of the iceberg. Nature 2015 520(7549):612. doi: 10.1038/520612a
  10. Miller JB, Sanjurjo A. Surprised by the Gambler's and Hot Hand Fallacies? A Truth in the Law of Small Numbers. IGIER Working Paper 2015. doi:
  11. Nuzzo R. Scientific method: statistical errors. Nature. 2014 506(7487):150-2. doi: 10.1038/506150a
  12. Peng RD. The reproducibility crisis in science A statistical counterattack. Significance 2015 12(3):30-32. doi: 10.1111/j.1740-9713.2015.00827.x
  13. Tukey JW. The future of data analysis. Ann. Math. Statist. 1962 33(1):1-67.
  14. Weissgerber TL, Milic NM, Winham SJ, Garovic VD. Beyond bar and line graphs: time for a new data presentation paradigm. PLoS Biol. 2015 13(4):e1002128. doi: 10.1371/journal.pbio.1002128.

These papers are listed here on this link and the associated pdfs are here as a zip file.

Add Discussion