R in 3 Months Week 8 (Advanced Data Wrangling)

Agenda

  1. Housekeeping

  2. Questions on Advanced Data Wrangling

  3. Dates

  4. Joins

  5. Iteration

  6. Next Week

Housekeeping

Housekeeping

  • Week 9: Advanced data viz

  • Week 10: Catch-up week

  • Week 11: Advanced data viz

  • Week 12: Advanced Quarto

  • Week 13: Wrap-up

Feedback

You can get feedback through the end of December

Your Questions

as.numeric() + parse_number()

Does using as.numeric() or parse_number() in R automatically change non-numeric characters into NA?

Why save as RDS vs CSV?

Dates

Joins

  • Mismatched variable types

  • Many-to-many joins

Assessment break

What happens to Mick after left_join(people, instruments, by = "name")?

people

name band
Mick Stones
John Beatles
Paul Beatles

instruments

name plays
John guitar
Paul bass
Keith guitar
  1. Mick is dropped because he has no match in instruments.

  2. Mick is kept, and his plays value is NA.

  3. The code throws an error because the key values don’t fully match.

  4. Mick is matched with Keith’s row because both play in a band.

Assessment break

What happens to Mick after left_join(people, instruments, by = "name")?

people

name band
Mick Stones
John Beatles
Paul Beatles

instruments

name plays
John guitar
Paul bass
Keith guitar
  1. Mick is dropped because he has no match in instruments.

  2. Mick is kept, and his plays value is NA.

  3. The code throws an error because the key values don’t fully match.

  4. Mick is matched with Keith’s row because both play in a band.

Iteration

Next Week

  • Advanced data viz, part 1: declutter and highlight your plots