🗓️ Session 9: Using AI for coding
In this lecture you learn the basics of using AI tools for coding tasks. While no AI tool will help you to write code in a language you do not understand, modern AI tools are well suited to assist you in writing code in a language you are familiar with. Here we discuss some of the most common use cases for AI when it comes to the development of R code. We focus on, first, getting a first sketch of an R script and, second, on using AI to help you find mistakes in your current code.
You also learn how important it is to provide the AI with context - something you can only do if you already know the basics of the programming language you and the AI are working with. Finally, we also touch upon some AI-like tools and advice on how to avoid typos in code.
👨🏫 Lecture Slides
Either click on the slide area below or click here to download the slides.
- Details for the exercise on e-commerce data (“generate R code”)
📚 Suggested Reading
- Anthropic’s Prompt Engineering Interactive Tutorial: a more extensive but very good course on how to develop good prompts
- How to use Github Copilot in R Studio and a guideline on how to get free student access through Github Education
- Resources for Gemini Code Assist, which is free but cannot be integrated directly into R Studio
- More information on Claude Code, which is most interesting for doing advanced programming work
- More information on Windsurf, which has a good free tier but no plugin for R Studio
✍️ Coursework
- Do the in-class exercises you did not complete during the session