Guide to Installing R Tutorial

We will be using a set of tutorials that run in R as an aide. To run them you need to install several packages (packages are addons for R that allow us to do things that base R does not). If you want to understand the details of what we are doing I’ve written an explanation below the steps.

Steps:

  1. Have R and RStudio installed.
  2. Open RStudio. On the leftside there will be a box called “R Console” you will type everything I tell you to in there.
  3. In the console type the below line and hit enter. This will install a package called remotes
    install.packages("remotes")
    
  4. Some text should popup that ends with ‘The downloaded binary packages are in’ followed by a long file path. If there is any red text you might have an error, contact me.
  5. Now type the below line and hit enter to install POL306 which has all the tutorials in it
    remotes::install_github("reuning/POL306")
    
  6. You will see more text again, although tis time there will be a lot more. Generally, as long as there is no red text it should be fine.
  7. Run one last line to check to make sure everything worked. You should see a message welcoming you to the tutorial, if you see “Error in library(POL306) : there is no package called ‘kevin’” then contact me.
    library(POL306)
    
  8. Close and reopen RStudio, you should have a Tutorial tab in the top right, click on it. It should list Introduction to R as the first tutorial. If not, contact me.

What are we doing here?

I wrote our tutorials into an R package, and have it available for anyone on Github. Github is used to share code and programs (as well as to develop them with a community). You can install a package from Github, but not natively in R. Instead we need the remotes package, which has a function called install_github(). So what we do is install remotes (install.packages('remotes')) then access the install_github() function from it to install my package (remotes::install_github('reuning/POL306')). Finally we load the POL306 package by calling library(POl306). We do not need to do this, but I wrote it so that if it loads successfully you will get a nice little message.