RStudio

RStudio is an integrated development environment, or IDE, for R programming. Download and install it from http://www.rstudio.com/download. RStudio is updated a couple of times a year. When a new version is available, RStudio will let you know.

When you start RStudio, you’ll see two key regions in the interface:


The tidyverse

You’ll also need to install some R packages.

An R package is a collection of functions, data, and documentation that extends the capabilities of base R.

Using packages is key to the successful use of R.

The most used packages that you will learn are part of the so-called tidyverse.

You can install the complete tidyverse with a single line of code:

install.packages("tidyverse")

You will not be able to use the functions, objects, and help files in a package until you load it with library(). Once you have installed a package, you can load it with the library() function:

library(tidyverse)

This tells you that tidyverse is loading the ggplot2, tibble, tidyr, readr, purrr, and dplyr packages. These are considered to be the core of the tidyverse because you’ll use them in almost every analysis.


Other packages

we’ll use three data packages from outside the tidyverse:

install.packages(c("nycflights13", "gapminder", "Lahman"))

These packages provide data on airline flights, world development, and baseball that we’ll use to illustrate key data science ideas.


Running R code

Code in R looks like this:

1 + 2
## [1] 3
#> [1] 3

If you run the same code in your local console, it will look like this:

> 1 + 2
[1] 3

A work by Matteo Cereda and Fabio Iannelli