Thanksgiving Dinner

Survey data, Network graphing

Notable topics: Survey data, Network graphing

Recorded on: 2018-11-20

Timestamps by: Alex Cookson

## Screencast

## Timestamps

Exploratory bar chart of age distribution (and gender) of survey respondents

Using count function on multiple columns to get detailed counts

Parsing numbers from text using parse_number function, then using those numbers to re-level an ordinal factor (income bands)

Exploring relationship between income and using homemade (vs. canned) cranberry sauce

Adding group = 1 argument to the aes function to properly display a line chart

Rotating text for axis labels that overlap

Getting confidence intervals for proportions using Jeffreys interval (using beta distribution with an uniformative prior)

Explanation of Clopper-Pearson approach as alternative to Jeffreys interval

Using geom_ribbon function add shaded region to line chart that shows confidence intervals

Using starts_with function to select fields with names that start with a certain string (e.g., using "pie" selects "pie1" and "pie2")

Using gather function to get wide-format data to tidy (tall) format

Using str_remove and regex to remove digits from field values (e.g., "dessert1" and "dessert2" get turned into "dessert")

"What are people eating?" Graphing pies, sides, and desserts

Using fct_reorder function to reorder foods based on how popular they are

Using n_distinct function count the number of unique respondents

Using facet_wrap function to facet food types into their own graphs

Using parse_number function to convert age ranges as character string into a numeric field

Exploring relationship between US region and food types

Using group_by, then mutate, then count to calculate a complicated summary

Exploring relationship between praying at Thanksgiving (yes/no) and food types

Empirical Bayes binomial estimation for calculating binomial confidence intervals (see Dave's book on Empirical Bayes)

Asking, "What sides/desserts/pies are eaten together?"

Calculating pairwise correlation of food types

Network graph of pairwise correlation

Adding text labels to nodes using geom_node_text function

Getting rid of unnecessary graph elements (e.g., axes, gridlines) with theme_void function

Explanation of network graph relationships

Adding dimension to network graph (node colour) to represent the type of food

Fixing overlapping text labels using the geom_node_text function's repel argument

Tweaking display of percentage legend to be in more readable format (e.g., "40%" instead of "0.4")

Summary of screencast