29/04/2018

Part 1. Introductions and setup

Session 1

Who we are!

Who we are!

Course structure

There will be 8 sessions over 2 days:

  • 6 of these will be on the materials we have developed
    • 3 each day
  • 2 empty sessions
    • to work with you and YOUR data, questions and problems

Course structure

Day 1

  • Introduction (Lex)
  • Regression I (Chris)
  • Visualisations with ggplot2 (Lex)

Day 2

  • Introduction to Spatial Data and Mapping (Lex)
  • Regression II: Other Forms of Regression (Chris)
  • Spatial Interaction Models - A Poisson Regression Approach (Chris)

Course structure

We have set aside time in the first session (Introduction) to make sure everything is set up

  • You have R installed
  • You can load all of the packages
  • You have all of the materials on your computer
  • To make sure that you establish robust workflows

Course structure

In each session

  • we will briefly introduce each Part (10-15 mins)
  • then you will work through the exercise documents
  • we will be going round the lab helping where it is needed
  • you are not just expected to run the code but to play with it as well!

Getting going

  • We will be working in R and RStudio
  • R is the engine

  • RStudio is graphical front end to R

  • we encourage you to work in RStudio

Homework and Preparation

Prior to this workshop you should have worked through the Session0 (Session0.html) worksheet, especially if you have not used R before. This introduces R / RStudio and some core operations.

Homework and Preparation

You should have made the following preparations:

  1. You should R and RStudio installed on your computer
  2. You should have done your homework and run the code in it
  3. You will need to have an internet connection – this is really important!
  4. All the data you and code you need are in the folders for each session
  5. If possible You should have prepared some data: a .CSV or EXCEL file with latitude and longitude, or a shapefile. PLEASE let us know if you want some data - we have lots!!!

Are there any Questions?

Part 2. Working in R

Working in R

Technical aspects

  1. Code is entered by a console
  2. You should write your code in a script (like a text file)
  3. This is not a typing / English lesson - so copy and paste from the documents
  4. You can run code from the script
  5. This means your code is saved, can be easily changed and re-run etc

Working in R

Technical aspects: RStudio start

Working in R

Technical aspects: Open a script

Working in R

Technical aspects: RStudio Components

Working in R

Conceptual aspects

  1. You are not expected to remember every R command, function, etc
  2. BUT ….you are expected to understand what you are trying to do with your code
    • so ask if you need to!!!
  3. For these reasons you should annotate your code - use the # in your script

Working in R

Conceptual aspects

  • Learning is R is learning to drive.
  • It takes time to become a good driver
  • Learning by doing is important

Why use R

  • R includes a very large number of tools, functions and packages
  • R has the latest methods and tools
  • New tools are in R 10-20 years before commercial software
  • The tools in R are open (i.e. the source code is visible)
  • This support research transparency
  • Oh - and R is free!

Aim of Session 1

To introduce

  • R packages
  • saving workspaces and projects
  • using scripts
  • loading data
  • simple visual data exploration (basic boxplots, histograms, scatter plots)
  • summary statistics

AND… to make sure you are all set up!

We hope you enjoy the workshop. Are there any Questions? Is everybody happy?