Homework 8: Last TidyTuesday

TidyTuesday

As with Homework 6, you will work with a TidyTuesday dataset and do a quick analysis. There are several goals:

  1. Practice generating your own research questions.
  2. Practice identifying what viz and wrangling tools are useful for addressing your questions.
  3. Hone your visualization and wrangling skills. Be creative while also maintaining the integrity of the graph.
  4. Get a sense of the broader data science community. Check out what people share out on X / Twitter using the #TidyTuesday hashtag. Maybe even share your own #TidyTuesday work on social media.

NOTE: Though you’re encouraged to work with others, all code and words must be your own.



Exercise 1: Data

Part a

Instead of picking your own dataset, you will use a recent dataset about Democracy and Dictatorship (or you can choose Valentines Day consumption).

Here, include:

  • A short (2–4 sentence) written description of this data. This should include:
    • the original data source (where did TidyTuesday get the data from?)
    • units of observation (what are you analyzing?)
    • data size (how many data points do you have? how many variables are measured on each data point?)
library(tidyverse)
democracy_data <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2024/2024-11-05/democracy_data.csv')
library(tidyverse)
historical_spending <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2024/2024-02-13/historical_spending.csv')
gifts_age <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2024/2024-02-13/gifts_age.csv')
gifts_gender <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2024/2024-02-13/gifts_gender.csv')

Exercise 2: Research Question and Viz

Part a

Write a clear research question related to your data here. This question must be nuanced enough to require analysis of the data. Your question may start as a broad question, and then it gets refined as you refine a visualization in part b. It doesn’t need to address all rows or columns in the data.

Research Question:





Part b

Construct 1 static visualizations that address the research question you refined above. Directions:

  • Do not include more than 1 viz – editing is a skill! Though you can only include 1 viz here, you should / will need to make several viz before finalizing your selection.
  • The viz must…
    • have meaningful axis labels and legend titles
    • have a figure caption (fig.cap)
    • use alt text (fig.alt)
    • use a color-blind friendly color palette
  • Challenge yourself! Remember that growth is a learning goal in this course.

Note: You may, but are not required, to utilize information from the rnaturalearth package to expand upon the information provided by TidyTuesday.

#library(rnaturalearth)
#world_boundaries <- ne_countries(returnclass = "sf")

Part c

Go to the documentation for the plotly package and read about how to use it. Look at examples such as the bar plot and try to adapt them to your situation; look for common code patterns.

Then, use plotly to make your static visualization above interactive.

Goal: In your project (and beyond this course), you may need to learn additional tools to tell the data story you want to tell. Learning how to use plotly is a good example of this. This is a chance to practice that skill!

#install.packages('plotly')
library(plotly)

Part d

Write a brief (2-4 sentence) summary of what you learn from the viz. Be sure to focus on the insight gain about the data context. This should connect back to your research question and be “professional” – pay attention to spelling, punctuation, grammar, capitalization, etc.

Discussion:





Render this file and submit the .html file to Moodle. This must include all code you used, as well as the output from that code.