Announcements

• Getting help during office hours:
• Feel free to use this as a “STAT545-dedicated workspace”.
• Getting help during class, me vs. your TA’s:
• Feel free to ask TA’s for help liberally!
• Still brainstorming ideas for distinguishing.

Today’s topics are:

1. Exploring data frames (in Rmd!)
• (originally from cm003)
2. Working locally with git
3. Collaboration with GitHub
• (originally from cm002)

To participate in today’s class, you’ll need:

• git installed
• A GitHub account
• RStudio installed

# 1 Exploring data frames (in Rmd!)

## 1.1 Learning Objectives

In our R exploration last time, we saw one way to bundle together multiple pieces of information: vectors. Now, we’ll turn to data frames.

By the end of this lesson, students are expected to be able to:

• Describe common properties of “built-in” R data frames using R
• Extract columns from a data frame

## 1.2 Resources

This lesson closely mirrors the stat545.com: care-feeding-data page for exploring data frames.

## 1.3 Getting Started

We’ll be working with the gapminder data set. To access it, in any R console, run the following:

install.packages('gapminder')

## 1.4 Demonstration

FIRST, let’s ensure your participation repo is setup.

1. Go to your github.com profile.
2. If you have a participation repository, but it’s not called STAT545_participation, I’ll show you how to rename it.
3. If you DON’T have a participation repository set up, let’s do that (I’ll make one, too).

Now, I’ve started a “cleaned up” version of the Rmd file we were exploring last time. Find it on GitHub!

Let’s build this up, and submit the result to your participation repository for your participation assessment.

# 2 Working locally with git

## 2.1 Learning Objectives

The concepts we’ll be touching on here are:

• clone
• stage
• commit (again!)
• pull/push

By the end of the lesson, students are expected to be able to:

• Demonstrate the above concepts using RStudio’s git client with your participation GitHub repository.

## 2.2 Resources

Want to try a similar lesson to today’s, but on your own? Follow along with happygitwithr: rstudio-git-github, which is closely aligned with the goals of this lesson.

Want to learn more, above and beyond what’s done in class? Take a look at these:

• Excellent resource by GitHub on how to “undo” almost anything (including “going back” to a previous state).

## 2.3 Getting Started

You’ll need to config your git using the command line.

Your RStudio will probably be able to “find” git. But if it can’t, you’ll encounter errors. See happygitwithr: see-git for help.

Optional (but recommended): After class, you might want to cache your credentials so that you don’t have to keep inserting your password.

## 2.4 Demonstration

The end product of this demonstration is a locally modified version of our data frame exploration, pushed to GitHub.

• What are “git clients”?
• We’ll be using the git client built-in to RStudio.
• Cloning:
1. Concept (remember “branches”?)
2. Practice with your participation repo. I’ll be using the Classroom repo.
• In RStudio, File -> New Project -> Version Control -> Git.
• You should see a Git tab in RStudio, upper-right corner window. If not, see happygitwithr: see-git for help.
• By the way:
• What’s an RStudio “project”?
• We don’t need to edit a file with RStudio to use its git client!
• File doesn’t need to have anything to do with R, either.
• Staging and committing:
1. Concept
2. Modify your Rmd exploration from earlier (just add a new line).
3. Stage and commit
• Push/Pull:
1. Concept
2. Try pushing!

__Before the world of git:__

Save perpetually.

__After embracing git:__

Save perpetually, commit often, push in case of fire.

Need help?

If you’re encountering problems, try:

The git documentation is not friendly. There’s even a parody on it.

# 3 Collaboration with GitHub

## 3.1 Learning Objectives: Collaboration with GitHub

The primary focus here is learning about leveraging GitHub’s version control for collaboration. The concepts are:

• GitHub Pages
• Forking
• Pull Request

Specifically, by the end of today’s class, students are expected to:

• Be able to make a basic website out of your participation repository using GitHub Pages
• Know roughly what the above concepts are about

## 3.2 Resources

The GitHub documentation is perhaps the best place to learn about these outside of class:

PS: You might want to sign up for a free GitHub Student Developer Pack. Amongst other perks, you get to make private repositories for free!

## 3.3 Demonstration

For participation marks, by the end of this demonstration:

• you’ll have a GitHub pages website set up for your participation repo
• you don’t need to have anything for the forking exercise!

Checklist:

1. Set up a basic “GitHub pages” website with your participation repo:
1. Go to “settings” on your repo.
2. Scroll down to “GitHub Pages”
3. Under “Source”, click the “None” drop-down button, and select the branch you want to turn into a website.
2. Forking a repo:
1. Let’s try forking the Classroom repo.
2. We’ll make a change, and will submit a pull request.

# 4 If there’s time remaining

• Concepts related to getting help in R (or with other computational problems):
• Google the error message (works most of the time)
• Write a question using a MWE. You’ll solve it yourself most of the time.
• Post question to thread such as SO.
• “Lab”