Welcome!

What is R and why are you here? Elon University

We are to spend our time tonight learning about R, R Markdown, and the developer environment that puts these tools together, R Studio. How do these tools fit together?

Scriptability, coding, working with our data \(\rightarrow\) R

Reproducible, literate programming with all of our code, narrative, and formatted output in one place \(\rightarrow\) R Markdown

A place to do this \(\rightarrow\) RStudio

Our most important goal: Get R and RStudio running on your computer and make you aware of a powerful set of tools for all types of data analysis, visualization, statistical methods, and report creation.

I’ll be using Socrative during class to take polls to see how we’re doing. You can join our room at https://api.socrative.com/rc/aABEGN.

Our Time Together

We will take roughly two to two and half hours to go through the basic material. We’ll code together, import some data, clean it up a bit, summarize it, and make a graph or three. Then, I’ll have you take the same data and do a bit more on your own. You will turn in your own R Markdown file with your work. I will provide step-by-step guidance as we go.

How These Notes Are Structured

On the left, you’ll find the section markers. Each section covers a portion of the material that we will be discussing this evening. You can always refer back to this.

  • Section 1 gets you up-and-running in R and R Studio, our development platform. I also quickly cover markdown and R Markdown notebooks, a way to combine code, text, and graphics in one document.
  • Section 2 introduces the tidyverse, or a suite of tools that speak a consistent language and that make using R even easier. We’ll discuss how to import our data, clean it up, and get some basic statistics done.
  • Section 3 discusses how data visualization, one of the most powerful features of R. In particular, we’ll use the ggplot2 package from the tidyverse.

What are we not doing?

If you’re familiar with other programming languages, you might be wondering where the matrices, vectors, and lists are? R has them - we’re just skipping some of the core, foundational ideas to go right into the tidyverse. Even without any additional tools like the tidyverse, Base R is a powerful way to do statistics and is the preferred path for some, especially those looking for speed and to combine R with other languages, like C++.

Data Camp has a free introduction to Base R concepts, if you’d like to see more.

We are going to look at the tidyverse first, since you can get up and running with your analysis quickly. If you want to go deeper into R, though, I do recommend going “back to basics” at some point.