Primary method of communication
The team’s primary method of communication outside of meetings (e.g. Slack, text messages, etc.)
In this lab, you will…
lab-02
. It contains the starter documents you need to complete the lab.lab-02.qmd
and Render it.After lab-2, lab assignments will be group based, and we will shortly be starting the group project.
In this lab, you are going choose who you want to work with. Groups are to be made up of 3-4 students per group. If you would like to be assigned to a group, please reach out to the TA.
In the real world, data scientists and statisticians often work in research teams. It is a skill to be able to communicate and work together on common projects. Thus, the remaining labs + your project will be team based.
Teams work is better when members have a common understanding of the team’s goals and expectations for collaboration. The purpose of this activity is to help your team making a plan for working together during lab and outside of the scheduled lab time.
Each team member will have some ideas about how a team should operate. These ideas may be very different. This is your opportunity to share your thoughts and ideas to promote optimal team function and prevent misunderstandings in the future.
Discuss with your group a team name to be called. Your GitHub repos will be created for this team name moving forward. Report your team name to your Lab Leader before moving on.
There are two items you need to complete when forming your group.
– Report your group members and team name to your TA to be recorded
– Fill out the team agreement
Team agreement: Discuss each of the items below with all in-person team members. If necessary, also follow up this week with any missing team members.
Have one person act as the recorder and type the team’s decisions in the team-agreement.qmd
file.
Be sure the team agrees on an item before it is added to the document.
Once the document is complete, the recorder should render, commit, and push the team agreement to GitHub. All team members can refer to this document throughout the semester.
This is not graded for accuracy, and simply acts as a tool to facilitate good group work.
Identify a 1 - 2 hour weekly block outside of lab where the team can meet to work on assignments. All team members should block off this time on their calendar in case the group needs to meet to finish lab or work on the project.
How the team will meet to work together (e.g. in-person, Zoom, Facetime, Google Hangouts). Be sure every member is able to access the virtual meeting space, if needed. If you are unable to find a weekly time when the team can meet, briefly outline a plan to work on assignments outside of lab. Otherwise, you can delete this item.
The team’s primary method of communication outside of meetings (e.g. Slack, text messages, etc.)
Keep in mind your team may want to have time to review the lab before turning it in to make sure it is a cohesive write up.
If someone is missing in your lab, and you would like them to be a part of your team, please communicate this information with both them and the TA so this can be documented.
Note: This lab still requires individual submissions!
Before we introduce the data, let’s warm up with some simple exercises.
.qmd
and .pdf
files. If anything is missing, render, commit, and push again.We’ll use the tidyverse package for much of the data wrangling. This package is already installed for you. You can load it by running the following in your Console:
The dataset for this assignment can be found as a CSV (comma separated values) file in the data
folder of your repository. You can read it in using the following.
nobel <- read_csv("data/nobel.csv")
The descriptions of the variables are as follows:
id
: ID numberfirstname
: First name of laureatesurname
: Surnameyear
: Year prize woncategory
: Category of prizeaffiliation
: Affiliation of laureatecity
: City of laureate in prize yearcountry
: Country of laureate in prize yearborn_date
: Birth date of laureatedied_date
: Death date of laureategender
: Gender of laureateborn_city
: City where laureate was bornborn_country
: Country where laureate was bornborn_country_code
: Code of country where laureate was borndied_city
: City where laureate dieddied_country
: Country where laureate dieddied_country_code
: Code of country where laureate diedoverall_motivation
: Overall motivation for recognitionshare
: Number of other winners award is shared withmotivation
: Motivation for recognitionIn a few cases the name of the city/country changed after laureate was given (e.g. in 1975 Bosnia and Herzegovina was called the Socialist Federative Republic of Yugoslavia). In these cases the variables below reflect a different name than their counterparts without the suffix _original
.
born_country_original
: Original country where laureate was bornborn_city_original
: Original city where laureate was borndied_country_original
: Original country where laureate dieddied_city_original
: Original city where laureate diedcity_original
: Original city where laureate lived at the time of winning the awardcountry_original
: Original country where laureate lived at the time of winning the awardThere are some observations in this dataset that we will exclude from our analysis to match the Buzzfeed results.
nobel_living
that filters forcountry
is available"org"
as their gender
)died_date
is NA
)Confirm that once you have filtered for these characteristics you are left with a data frame with 228 observations, once again using inline code.
… says the Buzzfeed article. Let’s see if that’s true.
First, we’ll create a new variable to identify whether the laureate was in the US when they won their prize. We’ll use the mutate()
function for this. The following pipeline mutates the nobel_living
data frame by adding a new variable called country_us
. We use an if statement to create this variable. The first argument in the if_else()
function we’re using to write this if statement is the condition we’re testing for. If country
is equal to "USA"
, we set country_us
to "USA"
. If not, we set the country_us
to "Other"
.
Next, we will limit our analysis to only the following categories: Physics, Medicine, Chemistry, and Economics.
For the following exercises, work with the nobel_living_science
data frame you created above. This means you’ll need to define this data frame in your Quarto document, even though the next exercise doesn’t explicitly ask you to do so.
Create a faceted bar plot visualizing the relationship between the category of prize and whether the laureate was in the US when they won the nobel prize. Interpret your visualization, and say a few words about whether the Buzzfeed headline is supported by the data.
Now is a good time to render, commit, and push. Make sure that you commit and push all changed documents and your Git pane is completely empty before proceeding.
born_country_us
in nobel_living_science
that has the value "USA"
if the laureate is born in the US, and "Other"
otherwise. How many of the winners are born in the US?Add a second variable to your visualization from Exercise 3 based on whether the laureate was born in the US or not. Create two visualizations with this new variable added:
Plot 1: Segmented frequency bar plot
Plot 2: Segmented relative frequency bar plot (Hint: Add position = "fill"
to geom_bar()
.)
Here are some instructions that apply to both of these visualizations:
Which of these visualizations is a better fit for answering the following question: “Do the data appear to support Buzzfeed’s claim that of those US-based Nobel laureates, most were born in other countries?” First, state which plot you’re using to answer the question. Then, answer the question, explaining your reasoning in 1-2 sentences.
Now is a good time to render, commit, and push. Make sure that you commit and push all changed documents and your Git pane is completely empty before proceeding.
nobel_living_science
data frame for laureates who won their prize in the US, but were born outside of the US, and then create a frequency table (with the count()
function) for their birth country (born_country
) and arrange the resulting data frame in descending order of number of observations for each country. Which country is the most common?Now is a good time to render, commit, and push. Make sure that you commit and push all changed documents and your Git pane is completely empty before proceeding.
Once you are finished with the lab, you will your final PDF document to Gradescope.
To submit your assignment:
Component | Points |
---|---|
Ex 1 | 5 |
Ex 2 | 6 |
Ex 3 | 7 |
Ex 4 | 5 |
Ex 5 | 10 |
Ex 6 | 7 |
Team Agreement | 5 |
Workflow & formatting | 5 |
Total | 50 |