GitHub Copilot on Posit Cloud
Posit Cloud is an online platform that lets you organize data projects in an easy-to-use and collaborative environment.
If you have access to GitHub Copilot, you can now experience AI code assistance within your RStudio projects on Posit Cloud.
See it in action:
What is GitHub Copilot?
GitHub Copilot is a popular AI development tool that can convert human language commands into executable code or speed up your coding with intelligent autocompletion.
Respond to a command
You can write a comment in RStudio that prompts Copilot to create something specific. Simply type in what you are looking to accomplish, such as a function that calculates area. When you press Return on the keyboard, you’ll find Copilot’s code recommendation in gray placeholder text.
Like what you see? Accept the suggestion by pressing the tab key and then run the code as you normally would. An AI-generated function named area is now available in your environment.
You can then ask the AI to calculate the area for a specific set of measurements and Copilot will employ the formula that it created.
Autocomplete your work
Another opportunity is to use Copilot to speed up coding by taking advantage of real-time autocomplete recommendations. For example, simply start to type
ggplot( and watch Copilot provide suggestions to build out a full visualization.
Here is what Copilot came up with.
Not exactly what you were looking for? Provide a new prompt to have Copilot make a more refined recommendation.
Here is Copilot’s new output:
Not a bad start, especially if you know enough R programming to build upon base recommendations, troubleshoot issues, and work together with Copilot to build something great.
How to set up Copilot on Posit Cloud
Assuming you already have access to Copilot from GitHub, getting set up in RStudio on Posit Cloud is quick and easy.
- Create a new RStudio Project.
- Go to Tools in the menu and select Global Options.
- Select the Copilot tab and check the checkbox to Enable GitHub Copilot.
- Click Install to install the agent in RStudio.
- Click the Sign In button that appears.
- Copy your verification code and then click the GitHub link.
- Paste the code from Step 6 on the GitHub activation page, and click Continue.
- Agree to authorize the plugin.
- Close the page and return to Posit Cloud.
You are now ready to start using GitHub Copilot on Posit Cloud. Just open a new script and get started!
Things to keep in mind
GitHub Copilot needs to be enabled and authorized for each new project. You must have access to GitHub Copilot via your GitHub account, and you must authenticate with that account before you can use GitHub Copilot in your projects. GitHub Copilot is free for students and teachers.