
GitHub Copilot on Posit Cloud
Speed up your coding projects in the RStudio IDE on Posit Cloud with GitHub Copilot, an AI coding assistant. Learn more in our blog post: https://posit.co/blog/github-copilot-on-posit-cloud/ Posit Cloud: https://posit.cloud/ GitHub Copilot: https://github.com/features/copilot RStudio User Guide: https://docs.posit.co/ide/user/ide/guide/tools/copilot.html
image: thumbnail.jpg
Transcript#
This transcript was generated automatically and may contain errors.
Hi, today we're going to show you how to connect GitHub Copilot to an RStudio project on Posit Cloud. The first thing to do is create a new RStudio project, and when the project is loading, we can go ahead and give it a name, maybe AI Coding Assistant, and then as soon as the project loads, we're going to go ahead and authenticate through GitHub.
Connecting GitHub Copilot
To do that, you're going to click Tools on the navigation bar, then Global Options, scroll down to Copilot, and you can enable GitHub Copilot. First you're going to install some packages in the IDE, and once this is ready, you're going to be able to sign in now to GitHub. So if you click on this button, it's going to give you a verification code, you can copy that and take it to a GitHub link.
Paste in the verification code, click Continue, Authorize GitHub Copilot, and now you're done here, you can close this tab, and come back into the IDE. This will update, and it'll show you that you are now logged in and ready to use Copilot.
Using Copilot in a script
So we can open up a new script to show it off, maybe I'll rename that EDA.R, and we can start passing in, you know, human language text, right? Make a function that's going to calculate the area of a room.
You can click Enter, and you're going to see the recommendation from GitHub Copilot. You can click Tab to accept the recommendation, and you can run it, and now you have a function area in your environment. You can also ask it to say, you know, I have a room of a certain size, find out the area of the floor, and it's going to know that it's going to take the formula that it just defined and be able to run this and find out that the area is in fact 80 for my size room.
You can also ask it to say, you know, I have a room of a certain size, find out the area of the floor, and it's going to know that it's going to take the formula that it just defined and be able to run this and find out that the area is in fact 80 for my size room.
I can also use, like, an autocomplete. So let's load in ggplot2, and if I start typing the function ggplot here, you're going to see that it's going to start filling it in for me with some, you know, recommendations. Okay, let's just go ahead and accept this and see what it comes up with. You know, a pretty basic first ggplot, but then you can work with it again with human language and say things like, well, maybe I want to change the color of the data points. I'm going to do that based on the variable class.
We can accept this and run it, and now we've got, you know, a slightly improved graphic, and you can keep iterating on this using Copilot to help you out, make new things, and hopefully make them faster.
