Skip to content

Latest commit

 

History

History
41 lines (32 loc) · 1.83 KB

readme.md

File metadata and controls

41 lines (32 loc) · 1.83 KB

R lessons

This is a set of R workshops I taught. This was given as a hand out, I would give a bit of a preamble about why R is great, then I would explain what each bit of code does, finally people would type in and run the code themselves. In a class of ~30 we'd work through each lesson in about 1.5-2 hours. This left plenty of time to discuss and clarify things with people without having to rush.

I would really recommend typing in the commands yourself as you learn because it makes it easier to understand what you're doing and you get used to the kinds of typos that trip people up!

A couple of things I would highlight

  • When you are using the console you can use the up and down arrows to cycle through previous commands which you can then run by pressing enter.
  • Using the console is fine for checking that things work but writing your code in a separate R script file makes it much much easier to organise.
  • Rather than copying code from your script file to the console to run it, press run to run the current line or selection of your script file. It's also good to learn the keyboard shortcut for this ctrl + R (windows), cmd + enter (mac) ctrl + enter (R studio).

Course structure

Introduction

Getting your data into R and editing it without going back into excel.

R graphics

Using ggplot2 for customising plots to produce high quality images for publication.

R graphics base

Making the same types of figures but using base R instead of ggplot2. This is probably slightly more complicated and you probably don't need to do both.

Linear models

How to perform simple analyses in R and interpret the results. R can do more statistical tests than we could possibly cover but after this session you will be able to teach yourself whatever you need.

R cheatsheet

Example code for most of what is covered in these lessons.