diff --git a/.nojekyll b/.nojekyll index 4ca6b72..707e429 100644 --- a/.nojekyll +++ b/.nojekyll @@ -1 +1 @@ -b755d935 \ No newline at end of file +2dfd8555 \ No newline at end of file diff --git a/01-handson_github_website.html b/01-handson_github_website.html new file mode 100644 index 0000000..ec07b8c --- /dev/null +++ b/01-handson_github_website.html @@ -0,0 +1,720 @@ + + + + + + + + + +Designing a Reproducible and Collaborative Lab (RCL) - Forks and Branches using the GitHub website + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +
+ + + +
+ +
+
+

Forks and Branches using the GitHub website

+
+ + + +
+ + + + +
+ + +
+ +

In this section we will be using the GitHub.com website and demonstrate that you do not need to be a programmer to use version control and edit files on GitHub, nor using branches

+
+ +
+
+

If you have not already created a GitHub username, please do so now:

+ +
+
+
+
+
+
+ +
+
+Our asks +
+
+
+
+

As a Team of two

+
    +
  • Help each other, everyone is bringing different skills! Talk it out!
  • +
  • Listen to each other; avoid judgment and solutioneering.
  • +
  • Have fun!
  • +
+
+
+

Prompt

+

We want to log the information about people’s favorite dessert using a repository.

+
+
+
+
+

Setup

+
+

Person 1 (owner):

+
    +
  • Create a repository using the following these instructions steps 1-6
  • +
+
+
+

+
+
+
    +
  • Edit the README.md to: +
      +
    • Click on pen at the top of the README.md file
    • +
  • +
+
+
+

+
+
+
    +
  • Replace the title (first line starting with #) with something better! Maybe Favorite Desserts
  • +
  • Add your name and your favorite dessert below the title: e.g. - Julien: crepes
  • +
+

You should now have a README similar to this:

+
+
knitr::include_graphics("img/github-readme_desserts.png")
+
+

+
+
+
+
+
+

Forks

+
+

Person 2: Create a Fork

+
    +
  • Ask your teammate to Slack you the link to the repository
  • +
  • Create a Fork by clicking on the Fork button on the top right view of your repository homepage
  • +
+
+
+

+
+
+
    +
  • On your Fork, start editing the README.md

  • +
  • Add your name and your favorite dessert below your teammate entry: e.g. - Sophia: chocolate

  • +
  • Add a descriptive commit message

  • +
+
+
knitr::include_graphics("img/github-commit.png")
+
+

+
+
+
    +
  • Commit your changes
  • +
+
+
+

+
+
+
    +
  • Create a pull request to merge those changes to the main repository using these instructions
  • +
+
+
+

Person 1:

+
    +
  • Go to your repository and merge the PR
  • +
+
+
+
+
+

Branches

+
+

Person 1: add a file

+

Download this csv file about your favorite desserts to your computer

+
    +
  • Just drag and drop it on the Github web page of your repository to upload it
  • +
  • Add a short message about the file: e.g. Adding dessert csv & hit Commit changes
  • +
  • Your file has been uploaded. Click on the filename to see it!
  • +
+

You should have something similar to this repo: https://github.com/brunj7/favorite-desserts/blob/master/favorite_desserts.csv

+

Now you want to collaborate more closely and do not wan your teammate to have to create a fork and be able to work directly on your repository

+
    +
  • Add Person 2 as a collaborator following these instructions
  • +
+
+
+

Person 2: Create a branch

+
    +
  • Check your email or Github Notifications to accept the invitation
  • +
  • Go to the repository website (link is provided in the invitation)
  • +
  • Create a new branch named after your first name
  • +
+
+
knitr::include_graphics("img/github-create_branch.png")
+
+

+
+
+
    +
  • Edit the csv file directly on GitHub to add your favorite dessert to it
  • +
  • Create a Pull Request (PR) to merge you branch back to main
  • +
  • Assign person 1 as a reviewer (instructions)
  • +
+
+
+

Person 1: Merge the branch

+
    +
  • Review PR
  • +
  • Merge and close PR
  • +
+ + +
+
+ +
+
+


+

UCSB library logo

+

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License

+
+ + + +
+ + + + \ No newline at end of file diff --git a/02-handson_github_rstudio.html b/02-handson_github_rstudio.html new file mode 100644 index 0000000..e8ff5a1 --- /dev/null +++ b/02-handson_github_rstudio.html @@ -0,0 +1,596 @@ + + + + + + + + + +Designing a Reproducible and Collaborative Lab (RCL) - GitHub branches using RStudio + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +
+ + + +
+ +
+
+

GitHub branches using RStudio

+
+ + + +
+ + + + +
+ + +
+ +
+

Is your fav’ dessert iconic !?!

+

Write and R script to compare the csv with your favorite desserts you modified previously with the top 42 most iconic American desserts

+
    +
  1. Clone the repository you just created to Taylor
  2. +
  3. Create a new branch using RStudio and name it *myinitials*_rstudio
  4. +
  5. Start a new script named desserts_match_*myinitials*.R
  6. +
  7. As pair programming, write a script should read a csv file of your favorite dessert (create it if you do not have one yet) and the csv file with the most iconic desserts (see code below) into R and find out if your favorite dessert is part of the most iconic desserts!
  8. +
  9. Push your changes to GitHub
  10. +
  11. On the GitHub website, create a Pull Request (PR) and assign your teammate as reviewer
  12. +
  13. Reviewer – Review the PR. Make comments and/or OK the merge
  14. +
  15. Requester – Merge and close the PR
  16. +
+
+
+
+ +
+
+Code to get the iconic desserts listing +
+
+
+
+
library(tidyverse)
+library(rvest)  # use to scrape website content
+
+# Check if that data folder exists and creates it if not
+dir.create("data", showWarnings = FALSE)
+
+# Read the webpage code
+webpage <- read_html("https://www.eatthis.com/iconic-desserts-united-states/")
+
+# Extract the desserts listing
+dessert_elements<- html_elements(webpage, "h2")
+dessert_listing <- dessert_elements %>% 
+  html_text2() %>%             # extracting the text associated with this type of elements of the webpage
+  as_tibble() %>%              # make it a data frame
+  rename(dessert = value) %>%  # better name for the column
+  head(.,-3) %>%               # 3 last ones were not desserts 
+  rowid_to_column("rank") %>%  # adding a column using the row number as proxy for the rank
+  write_csv("data/iconic_desserts.csv") # save it as csv
+
+
+
+ + +
+ +
+
+


+

UCSB library logo

+

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License

+
+ + + +
+ + + + \ No newline at end of file diff --git a/coding.html b/coding.html index f8ef292..f5c090a 100644 --- a/coding.html +++ b/coding.html @@ -134,6 +134,18 @@ Short intro to GitHub + + + + + + + + +