class: center, middle, inverse, title-slide # Lab 04 ## Analysis of Variance ### 02.06.20 --- class: center, middle # Welcome to lab --- ### Agenda 1. Merge conflicts 2. Lab introduction --- class: middle, center ## Merge Conflicts --- ### What are merge conflicts? When two collaborators make changes to a file and push the file to their repo, git merges these two files. <img src="img/03/merge-no-conflict.png" width="300" style="display: block; margin: auto;" /> If these two files have conflicting content on the same line, git will produce a <font class="vocab">merge conflict</font>. <img src="img/03/merge-conflict.png" width="300" style="display: block; margin: auto;" /> --- ## Resolving merge conflicts - Merge conflicts need to be resolved manually, as they require a human intervention <img src="img/03/merge-conflict-identifiers.png" width="800" style="display: block; margin: auto;" /> - To resolve the merge conflict - decide if you want to keep only your text or the text on GitHub or incorporate changes from both texts - delete the conflict markers `<<<<<<<`, `=======`, `>>>>>>>` and make the changes you want in the final merge --- ### Practice dealing with merge conflicts We will walk through an activity as a class to practice dealing with merge conflicts. .alert[ - Clone the lab-04-merge-conflict repo and start a new R project. - Assign numbers 1, 2, 3, 4 to each team member. 🛑 Wait for instructions before moving on to the next step. ] --- ### Let's cause a merge conflict! - We will take turns in completing the exercise, only one member at a time. - All other members should get up and look over the shoulder of the member who is doing the exercise. --- ### Team Member 1 .alert[ - Change the text **`This is line 1 of text`** to something else, e.g. **`I love regression!`**. - Commit and push. 🛑 Wait for instructions before moving on to the next step. ] --- ### Team Member 2 .alert[ - Do not pull! - Change the text **`This is line 1 of text`**. to something else, e.g. **`R is fun!`** - Commit and attempt to push, you should get an error. - Read the error message as a group. - Pull. - Take a look at the document with the merge conflict. Clear the merge conflict by choosing the correct/preferred change. - Commit, and push. 🛑 Wait for instructions before moving on to the next step. ] --- ### Team Member 3 .alert[ - Do not pull! - Change the text **`This is line 2 of text`**. to something else, e.g. **`I love statistics!`** - Commit and attempt to push, you should get an error. - Read the error message as a group. - Pull. - No merge conflicts should occur. Now push. 🛑 Wait for instructions before moving on to the next step. ] --- ### Team Member 4 .alert[ - Change the text **`This is line 2 of text`**. to something else, e.g. **`This is the last one!`** - Commit and attempt to push. You should get an error. - Read the error message as a group. - Pull. - Take a look at the document with the merge conflict. - Clear the merge conflict by choosing the correct/preferred change. - Commit, and push. 🛑 Wait for instructions before moving on to the next step. ] --- ### All Group Members .alert[ - Back to your seats. - Pull, and observe the changes in your document. ] --- ### Tips for collaborating via GitHub - Always pull first before you start working. - Knit, commit, and push often to minimize merge conflicts and/or to make merge conflicts easier to resolve. - If you find yourself in a situation that is difficult to resolve, ask questions asap, don't let it linger and get bigger. - The best way to avoid merge conflicts: work together in-person as much as possible! --- ### Lab introduction - <font class="vocab">Goal: </font> Use ANOVA to compare group means - <font class="vocab">Data:</font> `diamonds` data set in the ggplot2 package - Learn about attributes of diamonds: - [https://www.gia.edu/diamond-quality-factor](https://www.gia.edu/diamond-quality-factor) - Today's lab will focus on the cut and price for diamonds that weight 0.5 carats --- ### Getting started See the "Getting Started" instructions in [Lab 01](https://www2.stat.duke.edu/courses/Spring20/sta210.001/labs/lab-01-review-r.html#getting-started) if you need a reminder about cloning a repo and starting a new project.