Working with multiple data frames

Lecture 6

Dr. Mine Çetinkaya-Rundel

Duke University
STA 113 - Fall 2023

Warm up

Reflection

What is one thing you learned from your reading or videos that was “new” to you? And what is one question you have from the reading, videos, or material we’ve covered so far, including the previous application exercise?

Announcements

  • Project 1 proposal due Thursday at 5 pm
  • Next week:
    • Tuesday: Exam 1 - in class
    • Thursday: Exam 1 - take home due

Asking questions

  • Asking code related questions on Slack

    • Ideally: Code formatted text, not screenshots
    • If need be: Screenshots, not photos of screens
    • Always include code along with the error
  • Troubleshooting 101: Read your error messages in full, out loud if need be

  • Code formatting 101:

    • Always line breaks after + and |>

    • Add line breaks as needed after , to help fit code on rendered PDF

    • Think poetry (short lines), not novellas (long sentences)

Joining datasets

Joining student data

Describe a scenario where two datasets that contain information about students from this class may need to be joined. What might the analysis be about? What column (information) could be used to join the datasets?

Data: Fisheries of the world

  • Dataset 1: Data from various countries on fishing harvest

  • Dataset 2: Countries and continents

  • Observations: Each row represents a country

Plan

We…

have two data frames

want to join them, slice them, dice them, juice them, and process them, so we can plot them

Application exercise

ae-06

  • Go to the course GitHub org and find your ae-06-fisheries (repo name will be suffixed with your GitHub name).
  • Clone the repo in Posit Cloud, and set up your PAT:
    • In the Console, run usethis::create_github_token() to create a new PAT or grab the one you created previously from a space you might have safely stored it (e.g., 1Password or similar)
    • In the Console, run gitcreds::gitcreds_set() and paste your PAT when prompted.
    • In the Terminal, run git config credential.helper store to make sure your PAT persists throughout the whole time you’re working on this assignment / Cloud project.
  • Open the Quarto document (.qmd) and follow along and complete the exercises.
  • Render, commit, and push your edits as you work through it