---
title: "Homework 8: Last TidyTuesday"
author: "PUT YOUR NAME HERE"
date: now
date-format: "YYYY-MM-DDTHH:mm:ssZ"
format:
  html:
    toc: true
    toc-depth: 2
    embed-resources: true
    code-tools: true
    df-print: paged
---


```{r setup, echo = FALSE, warning = FALSE}
# Don't modify this!
knitr::opts_chunk$set(collapse = TRUE, 
                      warning = FALSE,
                      message = FALSE,
                      fig.height = 2.75, 
                      fig.width = 4.25,
                      fig.env='figure',
                      fig.pos = 'h',
                      fig.align = 'center')
```







# 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.


> **Important:** If you find and use code that we haven't covered in class (through internet searches, GenAI, human resources), **you need to cite your sources and explain what the new code does**. You can add this text in a paragraph below your main response for an exercise part.

\
\


## Exercise 1: Data

### Part a

Go to [TidyTuesday](https://github.com/rfordatascience/tidytuesday/tree/master/data/2024/2024-11-05).
Instead of picking a dataset, you will use a recent dataset about Democracy and Dictatorship. 

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?)








```{r}
library(tidyverse)
democracy_data <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2024/2024-11-05/democracy_data.csv')
```


```{r, include = FALSE}
# Explore Area

```



## 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 (if using color in your viz)
- Challenge yourself! Remember that *growth* is a learning goal in this course.

Note: You may (but are not required to) use information from the `rnaturalearth` package to expand upon the information provided by TidyTuesday.

```{r}
# library(rnaturalearth)
# world_boundaries <- ne_countries(returnclass = "sf")


```


```{r}


```


### Part c

Go to the [documentation for the `plotly` package](https://plotly.com/ggplot2/) and read about how to use it. Look at examples such as [the bar plot](https://plotly.com/ggplot2/bar-charts/) 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!

(You'll need to run `install.packages("plotly")` in the Console first.)

```{r}
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:





\
\
\
\



# Resource reflection

List the resources you used to complete this assignment (e.g. office hours, friends, course notes, Gen AI (including prompts), internet searches, R help pages (by entering `?function` in the console), etc.).

- 
-
-

Write a few sentences about which resources were the most useful in helping you complete the assignment.

\
\
\
\




# Finalize your homework

- Render your qmd one more time and check out the rendered html.
    - Confirm that the html appears as you expect it and that it's correctly formatted.
    - Confirm that you haven't accidentally printed out long datasets.
    - Review your answers and make sure you addressed each question. For example, several questions ask for *both* some code / plot and a *discussion* or *summary* in words.

-   Submit your **HTML** file to the Homework 8 assignment on Moodle.

-   You're done with Homework 8. Congrats!!

