One of the most enjoyable parts of my job is teaching R to our incoming analysts. These analysts are largely recent college graduates with a limited background in computer science and statistics. Historically my job has been to teach them the basics of the Tidyverse over 3 half-days. I’m writing today to see if anyone can recommend some resources to help me with a new, specific teaching goal I have for this workshop: Computer Science basics.
The workshop I give is largely based on Garrett Grolemund’s workshop “Mastering the Tidyverse”. Back when I was self employed I got certified by RStudio to teach the Tidyverse. This primarily consisted of attending Garrett’s “train the trainer” workshop on pedagogy and being evaluated on a small lesson I created myself. As a bonus I was pointed to the slides Garrett created for when he teaches the Tidyverse himself (link). Those slides were an order of magnitude better than what I was using before. And while I wound up tweaking them slightly, they are still the basis of my current workshop.
Now that my company is largely proficient in the Tidyverse, I have a new teaching goal. In addition to teaching the incoming analysts the Tidyverse, I would like my company to become more proficient at the basics of Computer Science. Concretely, in this context, that means having people change their approach to what it means to code in R. Instead of “just” writing code to solve the problem in front of them, I’d like people to start thinking about writing code that can be reused across multiple projects. This means converting their scripts to generalized functions (and, eventually, putting them into our internal packages). In order to do this, they need to learn the basics of Computer Science: writing functions, using conditionals, and understanding things like variable scope and iteration.
If anyone knows of some open source slides or exercises for this, please let me know in the comments below. In the mindset of sharing, here are some exercises I improvised recently while mentoring a new analyst 1-1 who needed to learn the basics of writing functions:
When I mentioned this to a Manager at my company she commented that these lessons did not include either variable scope (which confuses some of her analysts) or the debugger (which her analysts do not know about). To me this underscored the potential value in finding a good existing workshop on these topics – as someone who has been a software engineer for most of his career, it’s hard to remember what all the basics are, let alone the best way to introduce them!
When I mentioned these lessons to a friend who teaches Python professionally, he said that he often has students write a function that counts the number of vowels in a string. I like this exercise. It would require me to teach for loops which, even though they are not as widely used in R as other languages, are helpful in learning to think algorithmically.
Please use the comments (or my Contact page) to share links to any sharable resources you know of that relate to teaching these topics in R. Thanks!