Introduction to R and RStudio


Figure 1

RStudio layout

Figure 2

RStudio layout with .R file open

Exploring Data Frames


Creating Publication-Quality Graphics with ggplot2


Figure 1

Blank plot, before adding any mapping aesthetics to ggplot().

Figure 2

Plotting area with axes for a scatter plot of life expectancy vs GDP, with no data points visible.

Figure 3

Scatter plot of life expectancy vs GDP per capita, now showing the data points.

Figure 4

Binned scatterplot of life expectancy versus year showing how life expectancy has increased over time
Binned scatterplot of life expectancy versus year showing how life expectancy has increased over time

Figure 5

Binned scatterplot of life expectancy vs year with color-coded continents showing value of 'aes' function
Binned scatterplot of life expectancy vs year with color-coded continents showing value of ‘aes’ function

Figure 6


Figure 7


Figure 8


Figure 9


Figure 10

Scatter plot of life expectancy vs GDP per capita with a trend line summarising the relationship between variables. The plot illustrates the possibilities for styling visualisations in ggplot2 with data points enlarged, coloured orange, and displayed without transparency.

Figure 11


Figure 12

Scatterplot of GDP vs life expectancy showing logarithmic x-axis data spread
Scatterplot of GDP vs life expectancy showing logarithmic x-axis data spread

Figure 13

Scatter plot of life expectancy vs GDP per capita with a blue trend line summarising the relationship between variables, and gray shaded area indicating 95% confidence intervals for that trend line.

Figure 14

Scatter plot of life expectancy vs GDP per capita with a trend line summarising the relationship between variables. The blue trend line is slightly thicker than in the previous figure.

Figure 15

Scatter plot of life expectancy vs GDP per capita with a trend line summarising the relationship between variables. The plot illustrates the possibilities for styling visualisations in ggplot2 with data points enlarged, coloured orange, and displayed without transparency.

Figure 16


Figure 17


Figure 18


Figure 19