This lab will not be graded - there is nothing to turn in. Please do sit with your lab group, as today we’ll practice dealing with merge conflicts (which is something I’m sure will happen this semester - it’s already happened to one team!)

Merge Conflicts (uh oh)

You may have seen this already through the course of your collaboration last week. When two collaborators make changes to a file and push the file to their repository, git merges these two files.

If these two files have conflicting content on the same line, git will produce a merge conflict. Merge conflicts need to be resolved manually, as they require a human intervention:

To resolve the merge conflict, decide if you want to keep only your text, the text on GitHub, or incorporate changes from both texts. Delete the conflict markers <<<<<<<, =======, >>>>>>> and make the changes you want in the final merge.

Assign numbers 1, 2, 3, and 4 to each of your team members (if only 3 team members, just number 1 through 3). Go through the following steps in detail, which simulate a merge conflict. Completing this exercise will be part of the lab grade.

Resolving a merge conflict

Step 1: Everyone clone the assignment repo in RStudio from the link and open file merge-conflict.Rmd. Don’t forget to configure git if you haven’t already done so:

Member 4 should look at the group’s repo on GitHub.com to ensure that the other members’ files are pushed to GitHub after every step.

Step 2: Member 1 Change the team name to your team name. Knit, commit, and push.

Step 3: Member 2 Change the team name to something different (i.e., not your team name). Knit, commit, and push.

You should get an error.

Pull and review the document with the merge conflict. Read the error to your teammates. You can also show them the error by sharing your screen. A merge conflict occurred because you edited the same part of the document as Member 1. Resolve the conflict with whichever name you want to keep, then knit, commit and push again.

Step 4: Member 3 Write some narrative in the space provided. You should get an error.

However, this time no merge conflicts should occur since you edited a different part of the document from Members 1 and 2. Read the error to your teammates. You can also show them the error by sharing your screen.

Click to pull. Then, knit, commit, and push.

Exercises

Once again we’ll explore the Beijing air quality data (since you’re already so familiar with them!). On HW 2, we explored relationships between weather- related phenomena and carbon monoxide (CO). However, there were five other pollutants measured as well.

In each of the models below, use the predictors temperature in Celsius, precipitation in millimeters, and wind direction. The pollutants are measured in micrograms per cubic meter.

  1. Fit a model that predicts very fine particulate matter PM2.5 using the predictors above (no need for interpretations, writing down a formal hypothesis test, etc.).
  2. Fit a model that predicts fine particulate matter PM10 using the predictors above.
  3. Fit a model that predicts sulfur dioxide SO2 using the predictors above.
  4. Fit a model that predicts ozone O3 using the predictors above.
  5. Given your four models, what might you say about weather phenomena and air quality? Are there any pollutants that do not match the broader trend you have found? Knowing this, when might you plan a vacation to Beijing (based on weather alone)?