Before our first section, please run make sure you have working and up-to-date installations of R and RStudio. We will make use both extensively in this course/section, so it is definitely worth doing right.

Installation

If you do not already have R and RStudio running on your computer, then you should install them both:

  1. Download R.
  2. Download RStudio.

RStudio is a super helpful IDE (integrated development environment) for R—it’s very helpful for both learning and using R.

If you already have R and RStudio on your computer, then you should make sure they are up to date. The current R version is 3.4.3 (a.k.a. Kite-Eating Tree). You can check your version of R by typing version into the R console. The current version of RStudio is 1.1.383.

I would also recommend making sure you have a working installation of LaTeX (ShareLaTeX is another nice tool that also has a lot of LaTeX help/tutorials). Pandoc is also also helpful.

Does it work?

Open RStudio. Type 1 + 1 in the console. Do you get 2? If so, it looks like things are working.

Resources for R

I’ve compiled a pretty large set of resources for R. You probably don’t need them right now, but know they are there. However, the best resources for learning R are:

Basic suggestions

  1. Nearly everything you do should be in an R script, as opposed to the command line. You will want to return to your code at some point, an R script makes this possible (plus you have to turn in your R script with your assignments).
  2. Comment your code.
  3. Be consistent with your coding conventions (especially naming).
  4. Be smart when naming files, folders, etc.. First, use names that are actually descriptive (e.g., CensusCountyDemographics.csv vs. cbn18319ddg890-7a.csv). Second, I’d suggest choosing either camelcase (WhatAGreatName.txt) or replacing spaces with underscores (what_a_great_name.txt).
  5. Make your life easier by organizing your files, directories, and using R’s paste0() (or paste()). See examples in Section 1.