All Projects → MarcKaufmann → R-Coding

MarcKaufmann / R-Coding

Licence: other
Coding 1: Data Management and Analysis with R

Programming Languages

r
7636 projects
Stata
111 projects

Introduction to Data Analysis in R

Lecture 0: Technical Prerequisites before Class 1

Please bring your own laptop to class and make sure to follow the steps below to install software needed for the class. Do this before attending the first class, and do the steps in order. If you get stuck, read the "What to do if I can't complete a step?" section below first, before emailing me.

  1. Install R from https://cran.r-project.org
  2. Install RStudio Desktop (Open Source License) from https://www.rstudio.com/products/rstudio/download
  3. Register an account at https://github.com
  4. In this step you install the tidyverse packages, which includes ggplot2, the plotting library that we will use in this course. Enter the following commands in the R console (bottom left panel of RStudio) and make sure you see a plot in the bottom right panel and no errors in the R console:
install.packages('tidyverse')
library(ggplot2)
ggplot(diamonds, aes(cut)) + geom_bar()

The remaining steps will allow you to install git and use it with RStudio:

  1. Bookmark, watch, or star this repository so that you can easily find it later
  2. Install git from https://git-scm.com/
  3. If you want to use SSH to pull/push changes, create an SSH key, see the instructions on GitHub.
  4. Fork the repository on GitHub: this will create a copy of the repository in my account and put this copy in your account, making it easy to pull (meaning 'get') new changes as I write them, while allowing you to make changes to your copy for assignments.

The next steps may be trickier to get right, so try to set it up for a while and ask for help -- but if it takes you longer than . We will go through in the first class as well, but you should attempt it.

  1. Clone your fork of the repository on Github (that is in your account) to a folder on your computer, say to your /home///R-Coding. For this, go to your fork of the repository and click on the green button saying 'Code' and copy the appropriate link: - if you did set up SSH keys, copy the SSH url (starting with [email protected]) - if you did not set up SSH keys, copy the HTTPS url (starting with https)

    • If command line interface means something to you, then open up a cli if you are on Linux or Mac, or launch the git bash application on Windows (it should have been installed with git)
    • Now navigate to the folder into which you want to clone your fork of the repository of this course. That is, if you want to have the repository in /home//courses/R-Coding, then change directory (with cd command) to /home//courses by typing the following (ignore the dollar-sign at the start, that is simply what that line is likely to look like):
    $ cd /home/<your-name>/courses
    • Next, clone the repository there by typing the following if you did set up SSH keys:
    $ git clone [email protected]:<your-username-on-github>/R-Coding.git

    and type the following if you did not set up SSH keys

    $ git clone https://github.com/<your-username-on-github>/R-Coding.git 

    If it was successfull, it will have created a new folder named R-Coding that contains the course files.

What to do if I get stuck or can't solve something?

You should try the following strategies in this order.

1. Use RStudio's built in help

If you don't know how to use a certain function, use R and RStudio's inbuilt help features.

2. Search the Internet

First search the internet to see if you can find the answer to your solution. Long after this class is over and when I won't be able to help you, the Internet will be alive and well (OK, maybe not well). Learning to solve your own issues will serve you for the long term, while asking me for help will not. Sites that are particularly likely to be helpful:

  • Stackoverflow
  • RStudio website

3. Slack Channel

Second, use the class specific slack channel to post your questions. Make sure to respond to others' questions that you know how to solve.

How To Ask for Help

TO BE COMPLETED

4. Message Instructor/TA on Slack

If you are uncomfortable posting your question to the whole class, you can message us directly on Slack.

I will however strongly discourage this as the term progresses if the reason that you don't want to post is that you simply feel it should be obvious or easy. Programming has lots of obscure corners, and I regularly spend anywhere between 5 minutes and 5 hours on installing or configuring various bits of software.

One particularly fun episode (far from the most time-consuming) was when it took me 3 hours to realize that the error I received trying to switch from http to https (from unencrypted to encrypted internet traffic, essentially) was due to me having forgotten to switch off a firewall on my own server. In between, I had found 3 other possible 'solutions' that involved installing various tools, changing parts of the database, and so on. In the end, it was solved by running:

$ sudo ufw allow https

yet it had wasted 3 hours of my time. Close to one hour per word I had to type.

5. Email

I discourage emails for technical issues, which should be kept on Slack for the benefit of users. For non-technical questions or concerns that are unlikely to be of interest to other students, or if you have a question that is somewhat private, you are welcome to write emails.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].