3 Setting up your computer

3.1 Goals

In this lesson you will start using the computer tools introduced in the previous lesson.

Your task for this lesson is to follow along with the instructions and provide some information on Brightspace at the link marked Task 2.

3.2 Introduction

The statistical software R and RStudio and version control software git will be used in this course. No prior experience with R, RStudio or git is assumed. We’ll take class time to learn the software.

In this lesson you will

  • install the software on your computer,
  • learn to use the software “in the cloud”,
  • create a github account, and
  • complete a task to let me know this is done or ask for help and tell me your github account name.

The steps below are demonstrated for a Windows and Macintosh computer in videos on Brightspace. available on Brightspace. If you use a Chromebook, you can’t install this software, so skip ahead to the rstudio.cloud section. If you use linux, follow the instructions below to install the software and contact me if you have trouble.

3.3 R

3.4 Rstudio

3.5 Git

  • To download and install git:
    • on Windows, go to git-scm.org and click on the link to download a version for Windows
    • on Macintosh, use the Terminal app and type xcode-select --install to download and install git. There should be two minus signs in front of “install”; some web browsers may display this incorrectly as a dash (one symbol).

3.6 rstudio.cloud

If you have a Chromebook you can use R, Rstudio and git through the cloud service rstudio.cloud. Everyone should learn to use the cloud service as a backup in case of problems with the software on their own computer.

3.7 Dalhousie on-campus labs

R and Rstudio are available on Dalhousie computer labs, but the git version control software must be installed following the instructions for Windows computers above. Since all your user files are erased from lab computers when you log out, this process must be repeated on each login.

3.8 Packages

You are not done downloading and installing software yet! Most of the tools we will use with R are distributed as add-on packages. These are bundles of software that add new functions to R. There are three steps to use a pacakge:

  • Install the package (done only once)
  • Tell R you will be using the package (done each time you start R)
  • Learn how to use the package (a major goal of this course)

I install new packages all the time on my machine. Right now I have 203 installed. It’s also common to update to new versions. Rstudio trys to help you identify packages you need to install – we’ll see how later on. An optional task for today is to install packages suggested by Healy in his Preface. (We’ll use lots more packages than this, but this is a good start.) Cut and paste the following R code into the window marked “Console” in Rstudio.

my_packages <- c("tidyverse", "broom", "coefplot", "cowplot",
                 "gapminder", "GGally", "ggrepel", "ggridges", "gridExtra",
                 "here", "interplot", "margins", "maps", "mapproj",
                 "mapdata", "MASS", "quantreg", "rlang", "scales",
                 "survey", "srvyr", "viridis", "viridisLite", 
                 "socviz", "devtools", "patchwork")

install.packages(my_packages)

3.9 Github

Github is a web service for sharing and publishing github repositories and many related services. For today, all you need to do is create an account and tell me your github name on a Brightspace quiz. Once I have your github name I will send you an invitation to join course resources by email.