HW1: Vectors, Tibbles, and Pipes
Download and Instructions
The name comes from Zen practice, where a koan is a small puzzle you sit with until understanding arrives. Each koan teaches one idea. This session’s set of koans cover creating vectors with c(), calling functions, chaining steps together with the pipe |>, and organizing data into tibbles, the tidy tables we’ll use all term.
First, download koans1.zip by clicking the link in the first paragraph. Unzip it, then open the project by double-clicking koans1.Rproj (not the individual .R files). If nothing happens when you double-click koans1.Rproj, open RStudio and navigate to File > Open Project, and then find koans1.Rproj in your Downloads folder.
Next, you’ll modify a keyboard shortcut for running the test files:
Macs: Tools > Modify keyboard shortcuts > Run a test file > Cmd Shift T > Apply
Windows: Tools > Modify keyboard shortcuts > Run a test file > Ctrl Shift T > Apply
Now open the first koan in the R/ folder. Work through the koan files in order: fill in the NULL placeholders in each file, run your code in the console (Ctrl/Cmd + Enter), then press Ctrl+Shift+T (Cmd+Shift+T on Mac) to run the tests. When every test passes, you’re done with that koan; when one fails, the test output tells you which question to revisit.
Make sure you complete each koan with 100% passing tests. After you’ve done that, go to your downloads folder and compress koans1 into a zip file. Finally, upload that zip file to Canvas for me to grade. The koans are due before class on Monday 10/5. If you get stuck, come to office hours or email to make an appointment.
Check Your Understanding
The multiple choice questions below cover the skills from the first set of koans.