Appendix A — Data
Every graph in this book is built from simulated data. Each chapter creates its own dataset in a code chunk you can see and run, using base R’s random number functions (rnorm(), rpois(), rgamma(), sample(), and friends) or the faux package. None of the examples depend on a data package, and each dataset has a late 90s theme to match the chapter’s graph.
A.1 Why simulated data?
I’ve found that simulated data solves two problems at once. First, it’s completely reproducible. Each chapter calls set.seed() (usually with a 90s year), so you’ll get the same values I did every time you run the code. Second, we know the truth behind every dataset. When we simulate 300 Pokémon starters with known probabilities, we can check how close the counts land, and that’s exactly what the Distribution section in each chapter does:
COUNT IT: look at the first few rows and summarize the values
DRAW IT: sketch the values in a simple picture that connects them to the chapter’s graph
NAME IT: name the distribution behind the data and walk through its formula
Real data ‘caught in the wild’ has its place, but you can’t look up the distribution it came from. Simulated data keeps the graph, the numbers, and the formula in sync, so you can see why a graph looks the way it does. Try changing an argument (a mean, a probability, or a sample size) in any chapter and re-run the code to see how the graph responds.
A.2 Datasets by chapter
The tables below list the dataset in each chapter, its 90s reference, the distribution it’s drawn from, and the seed passed to set.seed().
A.2.1 Univariate
| Chapter | Dataset | 90s reference | Distribution | Seed |
|---|---|---|---|---|
| Bar graphs | pokemon_starters |
Pokémon starters | Multinomial | 1998 |
| Histograms | ok_soda_sales |
OK Soda cans sold | Normal | 1014 |
| Frequency polygons | talkboy_clips |
Talkboy recorded messages | Gamma | 1999 |
| Dot plots | blockbuster_rentals |
Blockbuster Video rentals | Poisson | 1993 |
| Density plots | crystal_tasters |
Crystal Pepsi taste test | Normal mixture | 1998 |
| Violin plots | microdrive_photos |
IBM Microdrive photo sizes | Lognormal | 1999 |
| Box plots | mario_kart_laps |
Mario Kart 64 lap times | t | 64 |
A.2.2 Amounts
| Chapter | Dataset | 90s reference | Distribution | Seed |
|---|---|---|---|---|
| Grouped bar graphs | jp_dinos |
Jurassic Park paddocks | Normal | 1993 |
| Summary bar graphs | happy_meals |
McDonald’s Happy Meals | Poisson | 1997 |
| Overlapping bar graphs | netware_offices |
NetWare office workstations | Normal | 1990 |
| Heatmaps | fp_gags |
The Fresh Prince of Bel-Air gags | Binomial | 1990 |
| Waffle charts | pog_collection |
Pogs collection | Multinomial | 1993 |
| Cleveland dot plots | walkman_tests |
Sony Walkman battery tests | Normal (faux) |
1979 |
A.2.3 Proportions
| Chapter | Dataset | 90s reference | Distribution | Seed |
|---|---|---|---|---|
| Diverging bar graphs | lunchroom_survey |
Orbitz vs. Surge lunchroom survey | Multinomial | 1993 |
| Stacked densities | modem_sessions |
Netscape modem sessions | Normal and Bayes’ theorem | 1996 |
| Mosaic plots | titanic_fans |
Titanic moviegoers | Multinomial | 1997 |
| Pie charts | koosh_balls |
Koosh ball styles | Multinomial | 1993 |
| Treemaps | j2me_downloads |
J2ME game downloads | Poisson | 2003 |
A.2.4 Distributions
| Chapter | Dataset | 90s reference | Distribution | Seed |
|---|---|---|---|---|
| Overlapping histograms | tamagotchi_pets |
Tamagotchi lifespans | Weibull | 1997 |
| Overlapping frequency polygons | soaker_shots |
Super Soaker range | Normal | 1990 |
| Overlapping dot plots | goosebumps_readers |
Goosebumps books read | Poisson | 1992 |
| Beeswarm plots | tetris_games |
Tetris line clears | Negative binomial | 1989 |
| Overlapping density plot | pager_messages |
Two way pager messages | Normal | 1998 |
| Ridgeline plots | squeezit_drinks |
Squeezit flavors | Gamma | 1998 |
| Grouped box plots | oregon_trail |
The Oregon Trail | Lognormal | 1985 |
| Grouped violin plots | aim_buddies |
AOL Instant Messenger buddy lists | Poisson and normal mixture | 1997 |
| Raincloud plots | rzone_tries |
Tiger R-Zone first level times | Paired lognormal (faux) |
1994 |
A.2.5 Dates & times
| Chapter | Dataset | 90s reference | Distribution | Seed |
|---|---|---|---|---|
| Line graphs | batman_box |
Batman (1989) box office | Exponential decay, lognormal noise | 1989 |
| Grouped line graphs | nick_ratings |
Nickelodeon (SNICK) ratings | Normal | 1992 |
| Bump charts | springboard_sales |
Springboard module sales | Poisson | 2000 |
| Slope graphs | bayside_quizzes |
Saved by the Bell quizzes | Normal | 1989 |
| Stream plots | fad_sales |
90s fads (Hypercolor, slap bracelets) | Poisson | 1991 |
| Alluvial charts | y2k_households |
Y2K prep surveys | Markov chain (multinomial) | 1999 |
| Instance chart | lunch_trades |
Fruit Gushers lunch table trades | Poisson | 1993 |
A.2.6 Relationships
| Chapter | Dataset | 90s reference | Distribution | Seed |
|---|---|---|---|---|
| Scatter plots | doom_pcs |
Doom frame rates | Normal (censored) | 1993 |
| Grouped scatter plots | console_kids |
Sega vs. Nintendo | Bivariate normal (faux) |
1991 |
| Bubble charts | seinfeld_eps |
Seinfeld episodes | Gamma and lognormal | 1989 |
| Grouped bubble graph | ranger_fights |
Power Rangers vs. the Putties | Poisson | 1993 |
| Parallel sets | cuseeme_calls |
CU-SeeMe calls | Multinomial | 1995 |
| Density contours | bopit_players |
Bop It reaction times | Bivariate normal mixture (faux) |
1996 |
| 2D histograms | geocities_pages |
GeoCities page loads | Lognormal and normal | 1997 |
| Hexagon bins | surge_teens |
Surge soda and video games | Gamma and normal | 1996 |