Data import

Lecture 9

Dr. Mine Çetinkaya-Rundel

Duke University
STA 199 - Fall 2022

9/27/22

Warm up

While you wait for class to begin…

Important

Come up with at least one question you’d like to see answered in the Exam 1 review on Thursday.

Go to slido.com and submit your question with the code #sta199exam1.

You can also upvote others’ questions.

Announcements

  • Lab 3 due Friday night (11:59 pm) – but I strongly recommend you finish and submit it before the exam begins!

  • Exam 1 is released on Thursday at noon and is due at 2pm on Monday.

    • No TA OH during the exam.

    • I will have OH 4-5pm on Friday (on Zoom).

    • Any clarification questions must be emailed to me only.

    • No Slack use during the exam, even about non-exam related questions.

Exam study tips

  • Take notes that you can reference
  • Review feedback given to you on graded work
  • Revisit AEs
  • Review suggested solutions
  • Ask questions

New resources

On the course website:

From last time

Continue from last time: ae-06

  • Go to your container and open your ae-06 project.
  • Render, commit, and push.

Important

You will see an error. Read it and do as it says!

  • Pull.

  • Once again, render, commit, and push.

Recap of AE

  • A vector can only have one type of elements in it. Placing elements with different types into a vector cases type coercion.
  • Factor is a class that R uses for categorical data and factors allow us to customize order and behaviour of levels.

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

Application exercise

ae-07

  • Go to the course GitHub org and find your ae-07 (repo name will be suffixed with your GitHub name).
  • Clone the repo in your container, open the Quarto document in the repo, and follow along and complete the exercises.
  • Render, commit, and push your edits by the AE deadline – 3 days from today.