Research methods classes in graduate school generally teach important skills such as probability and statistical theory, regression, analysis of variance (ANOVA), maximum likelihood estimation (MLE), etc. While these are important methods for analyzing data and assessing research questions, sometimes drawing a picture (aka visualization) can be more precise than conventional statistical computations.
This page is a summary of A Layered Grammar of Graphics by Hadley Wickham. I strongly encourage you to read the original article in conjunction with this summary. library(tidyverse) library(knitr) library(palmerpenguins) Google defines a grammar as “the whole system and structure of a language or of languages in general, usually taken as consisting of syntax and morphology (including inflections) and sometimes also phonology and semantics”.
library(tidyverse) library(knitr) library(here) Figure 1: Charles Minard's 1869 chart showing the number of men in Napoleon’s 1812Russian campaign army, their movements, as well as the temperature they encounteredon the return path.
library(tidyverse) Run the code below in your console to download this exercise as a set of R scripts. usethis::use_course("cis-ds/grammar-of-graphics") Given your preparation for today’s class, now let’s practice generating layered graphics in R using data from Gapminder World, which compiles country-level data on quality-of-life measures.