4 An LLM Toolbox for R
This chapter covers
- Setting up the key LLM tools in RStudio: GitHub Copilot, aider, Open Interpreter, and TheOpenAir
- Using GitHub Copilot to speed up scripting
- Drafting code with aider
- Fetching and preparing data with Open Interpreter
- Interacting with the OpenAI API from within R with TheOpenAIR
This chapter provides a practical overview of various LLM tools that can be used from within RStudio. We will look at how to install and use GitHub Copilot, an AI-powered code assistant that suggests lines or blocks of code as you type. Then, we will go through each step of installing and setting up aider, a command-line tool that allows you to “pair program” with OpenAI’s GPT models as well as Open Interpreter, a GPT-based tool that generates and executes code based on your command-line instructions. Each of these tools can significantly enhance your coding experience in R.
4.1 Coding with GitHub Copilot: First Steps
Before you can harness the power of GitHub Copilot within RStudio, ensure you have a (free) GitHub account along with an active subscription to either Copilot for Individuals or Copilot for Business. Detailed pricing information can be found on the GitHub Copilot billing page: https://copilot.github.com/pricing. In addition, make sure your RStudio version is at least 2023.09.0.X.
4.1.1 How to Set Up GitHub Copilot in RStudio
To activate GitHub Copilot in RStudio, open RStudio and follow these steps: