Skip to content

Latest commit

 

History

History
 
 

README.md

This week covers:

  • An intro to Git and Github for sharing code
  • Command line tools
  • R and the Tidyverse

Day 1

Setup

Install tools: Visual Studio Code, Git for Windows, R

Visual Studio Code

Git for Windows

  • Install Git for Windows using the "Git for Windows installer"
  • Open Git Bash and check that you have git under bash by typing git --version in the terminal
  • Do the same within Visual Studio Code

R

Filesystem setup

  • Verify that you can see the same set of files through Git Bash and your Windows Explorer by opening Git Bash and typing ls and pwd to see the contents of your current directory and its location
  • Navigate to Windows Explorer and see if you can find the same directory and check its contents

Intro to Git(Hub)

Make your first commit and pull request

  • Sign up for a free GitHub account
  • Then follow this guide to fork your own copy of the course repository
  • Clone a copy of your forked repository, which should be located at https://github.com/<yourusername>/coursework.git, to your local machine
  • Once that's done, create a new file in the week1/students directory, <yourfirstname>.txt (e.g., jake.txt)
  • Use git add to add the file to your local repository
  • If needed, set your git username and email with git config --global user.name "Your Name" and git config --global user.email "you@youremail.com"
  • Set your default git editor to VSCode using git config --global core.editor "code --wait"
  • Use git commit and git push to commit and push your changes to your copy of the repository
  • Then issue a pull request to send the changes back to the original course repository
  • Finally, sync changes from the main repo to your fork with git pull upstream master (if your machine doesn't recognize upstream, do the following to create the upstream shortcut: git remote add upstream https://github.com/msr-ds3/coursework.git)

Learn more (optional)

Extra

Think about how to write a musical_pairs.sh script to determine your programming partner each day. We want the script to do the following:

  • Produce a (pseudo)random pairing of 6 groups of 2 people who get to work together each day on pair programming assignments
  • Any one of us should be able to run the script and get the same pairing on a given day (i.e., as long as our computers agree on the year/month/day)
  • It's interesting to think about how we might avoid repeated pairs from one day to the next, but for a first cut (and maybe final cut) version of the script you can ignore that issue

Day 2

Intro to the Command Line

Learn more (optional)

GitHub Copilot

Command line exercises

  • Pull changes from the msr-ds3/coursework repo: git pull upstream master
  • Use the download_trips.sh file to download Citibike trip data by running bash download_trips.sh or ./download_trips.sh
  • Fill in solutions under each comment in citibike.sh using the 201402-citibike-tripdata.csv file

Save your work

  • Make sure to save your work and push it to GitHub. Do this in three steps:
    1. git add and git commit and new files to your local repository. (Omit large data files.)
    2. git pull upstream master to grab changes from this repository, and resolve any merge conflicts, commiting the final results.
    3. git push origin master to push things back up to your GitHub fork of the course repository.
  • Finish by submitting a pull request with your solutions so we can review them! (We won't merge the request, but it's a good way for the TA to provide feedback.)

Day 3

R in Visual Studio Code

  • Install the R extension for VSCode
  • Install the R language server by typing the following in an R terminal: install.packages("languageserver")
  • Install the tidyverse package, which includes dplyr, ggplot2, and more, in an R terminal: install.packages('tidyverse', dependencies = T)

Intro to R

R counting exercises

  • Use the musical pairs script to determine your programming partner each day
  • Open VSCode in the coursework repository and set the working directory to week1 with setwd('week1')
  • Fill in solutions to the counting exercises under each comment in citibike.R
  • Do the following exercises from Chapter 5 of the 1st edition of R for Data Science:
    • Section 5.2.4, exercises 1 and 3
    • Section 5.5.2, exercise 2
    • Section 5.7.1, exercise 3

Learn more

Day 4

Plotting

Plotting exercises

  • Do the following exercises from Chapter 3 of the 1st edition of R for Data Science and do the following exercises:
    • Section 3.3.1, exercises 1, 2, and 3
    • Section 3.5.1, exercises 1 and 4
    • Section 3.6.1, exercises 5 and 6
    • Section 3.8.1, exercises 1 and 2
  • Citibike plots
    • Run the load_trips.R file to generate trips.RData
    • Write code in plot_trips.R to create visualizations using trips.RData

Learn more