Importing and recoding data

Lecture 10

2024-06-03

Tips for take-home exam

  • Do not discuss the take home exam with friends
  • Render to PDF after answering every sub-question.
  • After you render, always look at the PDF to make sure the output is what you expect.
  • Push your work to github after every question.
  • If you feel lost, refer to your AEs and Labs! Try to find a similar question to reference.

Project workflow and grading

  • Four milestones

  • Details outlined at https://sta199-summer24.github.io/project/.

  • Each milestone has points associated with it.

  • Additionally there are points allocated to reproducibility and organization as well as teamwork (to be measured by within team peer evaluations three times throughout the semester).

  • Most important thing you can do today for your project: Block off agreed times in your calendar!

Reading data into R

Reading rectangular data

  • Using readr:
    • Most commonly: read_csv()
    • Maybe also: read_tsv(), read_delim(), etc.
  • Using readxl: read_excel()
  • Using googlesheets4: read_sheet() – We haven’t covered this in the videos, but might be useful for your projects

Reading and writing CSV files

Age gap in Hollywood relationships

What is the story in this visualization?

Application exercise: ae-08-data-import

  • Go to the project navigator in RStudio (top right corner of your RStudio window) and open the project called ae.
  • If there are any uncommitted files, commit them, and then click Pull.
  • Open the file called ae-08-data-import.qmd and render it.
  • Work on Part 1.

Reading Excel files

Sales data

Are these data tidy? Why or why not?

Sales data

What “data moves” do we need to go from the original, non-tidy data to this, tidy one?

Application exercise: ae-08-data-import

  • Go back to your project called ae.
  • If there are any uncommitted files, commit them, and push.
  • Work on Part 2 in ae-08-data-import.qmd.

Application exercise: ae-09

  • Finish ae-09 before end of class.