Log in to GitHub to determine your team number and members for Lab 3.
Every team member should now go to the course GitHub organization and locate your lab 3 repository, which should have the prefix lab03. Copy the URL of the repository and clone in RStudio. If you have trouble, see the first lab for step-by-step instructions or ask a teammate for help.
Then, configure git in the console as we have done in previous labs, using your GitHub username and email address.
Do not edit the .Rmd
file until explicitly asked to do so in the instructions.
library(usethis)
use_git_config(user.name = "GitHub username", user.email="your email")
Just over 1 in 10 babies worldwide are born too soon, and the preterm birth rate has been increasing in most countries, according to the Global Action Report on Preterm Birth. In the poorest countries, roughly 12% of births are preterm, while this rate is only 9% in the highest income countries. Within countries, poorer families are at higher risk. Because preterm birth is associated with increased risk of morbidity and mortality, it is important to offer better pre-conception and pregnancy healthcare to reduce the likelihood an infant is born too early.
We consider 10,000 observations from a random sample of births in three countries. Variables include preterm
(which takes values preterm for births < 37 weeks and term for births \(\geq\) 37 weeks) and country
(Malawi, Nigeria, or South Africa).
Assign each team member a number 1 through 3 and write your number down on a piece of paper. This lab will walk you through the basics of team workflow step-by-step. If your team has just two members, then team member 1 should complete the first task (item 4) of member 3, and team member 2 should complete the other tasks of member 3.
Do the following exercises in order, following each step carefully.
Only one person at a time should type in the .Rmd
file and push updates.
The person working should share their screen, and the others should follow along.
Team member 1: Open the lab3.Rmd
file and change the author of the YAML header to the following “Team Number: Member 1, Member 2, Member 3” with your team number (for example Team 3) and the first and last names of all team members.
Team member 1: Run the load-data
code chunk to read in the data and print the first six rows. Share the results with your team members. Then, answer the questions below.
library(tidyverse)
load("preterm.Rdata")
head(preterm,2) #you'll want to modify this line!
## PTBstatus Country
## 1 preterm South Africa
## 2 term Nigeria
%>%
preterm group_by(Country) %>%
summarize(renamethis=n()) %>% #to summarize count
mutate(moreinformativename=renamethis/sum(renamethis)) #getting prob
## # A tibble: 3 x 3
## Country renamethis moreinformativename
## <chr> <int> <dbl>
## 1 Malawi 820 0.082
## 2 Nigeria 7860 0.786
## 3 South Africa 1320 0.132
Team member 1: When you have finished, knit to PDF, then stage, commit, and push your .Rmd
and PDF to GitHub with an appropriate commit message.
All other team members: Once your team member has pushed the work, pull to get the updated documents from GitHub. Click on the .Rmd
file and you should see the responses to the first two exercises. Knit the file to update your own documents.
Team member 2: It’s your turn. Answer the question below.
Team member 2: Knit to PDF, then stage, commit, and push your .Rmd
and PDF to GitHub with an appropriate commit message.
All other team members: Once your team member has pushed the work, pull to get the updated documents from GitHub. Click on the .Rmd
file and you should see the responses to the first three exercises. Knit the file.
Team member 3: It’s your turn. Complete the exercise below.
Team member 3: Knit to PDF, then stage, commit, and push your .Rmd
and PDF to GitHub with an appropriate commit message.
All other team members: Once your team member has pushed the work, pull to get the updated documents from GitHub. Click on the .Rmd
file and you should see the responses to the first four exercises. Knit the file.
Team member 1: It’s your turn. Complete the exercise below.
Country
and PTBstatus
independent, or not? Provide numeric calculations to support your answer.Team member 1: Knit to PDF, then stage, commit, and push your .Rmd
and PDF to GitHub with an appropriate commit message.
All other team members: Once your team member has pushed the work, pull to get the updated documents from GitHub. Click on the .Rmd
file and you should see the responses to the first five exercises. Knit the file.
Team member 2: Almost done! Your job is to explore the preterm birth rate in Malawi relative to that overall in poorer nations.
Team member 2: Check to confirm all code chunks are named and all code follows the tidyverse style guidelines. Make changes as necessary.
Team member 2: When you have finished, knit to PDF, then stage, commit, and push your .Rmd
and PDF to GitHub with an appropriate commit message.
All other team members: Once your team member has pushed the work, pull to get the updated documents from GitHub. Click on the .Rmd
file to see your final version of the lab.
Team member 3: Upload your team’s PDF to Gradescope. Include every team member’s name in the Gradescope submission and identify which problems are on each page in Gradescope. Associate the “Overall” section with the first page of your PDF.
There should only be one submission per team on Gradescope.
Total: 50 pts
Exercise 1: 7 pts
Exercise 2: 7 pts
Exercise 3: 7 pts
Exercise 4: 7 pts
Exercise 5: 7 pts
Exercise 6: 7 pts
Overall: 8 pts