2. How R and RStudio Work

Content for Wednesday, January 18, 2023


This week we will dive into using R. We’ll get oriented to the RStudio IDE and start writing code right away. At this point, there will be a lot of stuff that may seem confusing, or details that are easy to miss. Don’t worry. The most important thing is to start doing things in R and to not get discouraged if things don’t work as expected. Remember, on the one hand computing errors (and error messages) are weird and perplexing and frustrating. But on the other hand, this is mostly because computers are fast but dumb, and can only do what they are told, not what you want. This also means that when something fails, there’s always a reason, even if it’s weird or hard to track down.


  • Hadley Wickham, Garrett Grolemund, and Mine Çetinkaya-Rundel R for Data Science: Import, Tidy, Transform, Visualize, and Model Data, Second. (Sebastopol, CA: O’Reilly Media, 2023), https://r4ds.hadley.nz., Chapters 1 and 2.

Note: This reading is fully available online at the book’s website. Also, while it’s listed here as a “reading” I strongly recommend you work through the examples in the text as you read, typing them out as code chunks in a Quarto file and rendering them to see what happens.


View all slides in new window Download PDF of all slides


Tip: If you type ? (or shift + /) while going through the slides, you can see a list of special slide-specific commands.