Note: these are background chunks that are needed for knitting.

library(tidyverse)
library(lubridate)
library(scales)
library(DT)
library(unvotes)
unvotes <- un_votes %>%
  inner_join(un_roll_calls, by = "rcid") %>%
  inner_join(un_roll_call_issues, by = "rcid")

Photo by Ivan Bertolazzi from Pexels

Lab 1-Remix and Report

This first lab has a slightly different organization than you will see in the remaining labs.

The last two sections build off of the Quick-Start work you just completed. Here are the steps to follow:

  1. Open your Posit Cloud account and navigate to the Lab 1 Quick-Start project workspace. Use this link: Posit Cloud

  2. In your project Files, you should see a second RMarkdown ( .Rmd ) file named Lab-01-Remix-Student-Name.Rmd. This is your Remix & Report worksheet.

  3. Check the box beside the file’s name and select Rename. Carefully, edit the file name and replace “Student-Name” with your first name and last name separated by hyphens. For example, my lab file would be Lab-01-Remix-Dawn-Wright.Rmd.

  4. After you rename your worksheet file, click on that .Rmd file name to open it in the Source/Editor window.

  5. Replace “author” with your name, and put in the current date in place of the old date.

Caution!

Be careful to not change any thing else in the top of the document, which is called the “yaml”. All of your work will be after the notice in the document.

Remix

Follow the instructions in the Remix section of the template to edit the code chunks.

Use two different countries to replace China and Russia in the code chunk below.

See the Appendix below for the spelling of the country names in the data set.

Hint! There are two places in the code chuck where you will have to change the country names.

unvotes %>%
  filter(country %in% c("Russia", "United States", "China")) %>%
  mutate(year = year(date)) %>%
  group_by(country, year, issue) %>%
  summarize(percent_yes = mean(vote == "yes")) %>%
  ggplot(mapping = aes(x = year, y = percent_yes, color = country)) +
  geom_point(alpha = 0.4) +
  scale_color_manual(values = c("Russia" = "purple",
                                "United States" = "royalblue1", 
                                "China" = "orange")) +
  geom_smooth(method = "loess", se = FALSE) +
  facet_wrap(~issue) +
  scale_y_continuous(labels = percent) +
  labs(
    title = "Percentage of 'Yes' votes in the UN General Assembly",
    subtitle = "1946 to 2019",
    y = "% Yes",
    x = "Year",
    color = "Country"
  )

Run the edited code chunk to generate the new graph

Report

In the Report section of the template, answer these questions about what you have learned so far in Module 1:

Q1: What is your definition of “data literacy?”
Your answer here:

Q2: In the unvotes dataset, there are several kinds of variables. One way to classify them is by their Measurement Scale.

For information on Scales of Measurement, see your textbook Answering with Questions Section 1.8 Scales of Measurement

Q2a: What measurement scale is the variable “country” in the unvotes dataset?
Your answer here:

Q2b: What measurement scale is the variable “date” in the unvotes dataset?
Your answer here:

Hint
Hint

Recall you can click on the unvotes data object in the Environment to open it in the Source/Editor window to refresh your memory on the types of variables.

Q3: What do you see when you inspect the new facet graphs with your countries? How are they similar and different from the original set?
Your answer here:

Q4: Can you draw some conclusions about the three countries you selected? Why do you think they have similar or different voting trend lines?
Your answer here:

Q5: Discuss how you might be able to use this data visualization technique in your work or personal life?
Your answer here:

Q6: On a scale of 1 to 10, with 1 being “just starting” and 10 being “I’m cool with this,” where do you think you are on the continuum of data literacy? Why do you grade yourself this way?
Your answer here:

Lab Assignment Submission

Remember to save your Remix worksheet .Rmd file and Knit it as a Word or PDF document when you have completed the lab assignment. Note: to the right of the Knit icon, there should be a drop-down menu where you can select “Knit to Word” or “Knit to PDF.”

Finally, export the Lab-1-Remix-Your-Name Word or PDF document from Posit Cloud.

  • In the Files window, put a check mark by the files you want to export.

  • Go to More and click on the dropdown menu. Then select Export. The checked files will be downloaded to your computer.

Submit your Lab-01-Remix-Your-Name document file in your Canvas M1.6 Lab 1 Remix and Report: Quick Start Assignments area by Sunday Midnight ET.

Note: if you encounter difficulty getting your worksheet to Knit, you may submit your Lab 1-Remix-Your-Name.Rmd file saved with your work instead. Put a note in the Assignment Submission form about the problem you encountered.

In there is time, use Course Email to ask your instructor for help sorting out the issue.

The Lab 1 Quick Start Grading Rubric will be used.

Congrats! You are done with Lab 1!

leftPrevious: Lab 1 Rehearse 2 Debrief

Lab Manual Homepage

Appendix

Below is a list of countries in the dataset:

Creative Commons License
This work was created by Dawn Wright and is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Last Compiled 2024-01-06