This repository contains the materials for D-Lab R Copilot Assisted Coding Workshop.
Though GitHub Copilot is language agnostic, our examples will be in R. Therefore, we recommend attending D-Lab's R Fundamentals series prior to this workshop. If you use a language that is not R, you are still welcome to attend. Many of the examples will have analogs in other languages, such as Python.
Check D-Lab's Learning Pathways to figure out which of our workshops to take!
This workshop provides an introduction to coding with GitHub Copilot, an AI-powered coding assistant that can help you write code faster and more efficiently. First, we’ll cover how to install and set-up Visual Studio Code, a free code editor through which we will use GitHub Copilot. Then, we will go through the different features of GitHub Copilot and how to use them to help us code in R.
After this workshop, you will be able to:
-
Set-up and navigate Visual Studio Code.
-
Take advantage of the main functionalities of GitHub Copilot for coding.
-
Understand some of the strengths and weaknesses of AI coding assistants.
We will use Visual Studio Code, GitHub Copilot, and R to go through the workshop materials. We will walk through installing and setting up Visual Studio Code during the workshop, but you must have an existing subscription to GitHub Co-pilot and have R installed.
Follow the instructions here to subscribe to GitHub Copilot and here to install R. These instructions also describe setting up GitHub Copilot in Visual Studio Code, but you do not need to complete these steps before the workshop.
-
Download Visual Studio Code: Follow the links according to the operating system that you are running. Do this after you have already installed R.
-
Download these workshop materials:
- Click the green "Code" button in the top right of the repository information.
- Click "Download Zip".
- Extract this file to a folder on your computer where you can easily access it (we recommend Desktop).
Detailed installation instructions (including troubleshooting steps) can be found here.
If you do not have Visual Studio Code installed and the materials loaded on your workshop by the time it starts, we strongly recommend using our GitHub codespace to run the materials for these lessons.
You can create a codespace for this repository:
-
Click the green "Code" button in the top right of the repository information.
-
Click "Open with Codespaces".
-
Wait for the codespace to load. This may take a few minutes.
The codespace uploads this repository, along with any necessary packages, and
allows you to run the materials in the cloud in a virtual Visual Studio Code that will look basically like what is on your computer.
No installation is necessary from your end, you only need an internet browser. To download your work from the codespace, right-click on the file you want to download in the Explorer
panel on the left-hand side and click Download...
(Note: you may have to click Allow
on a security pop-up). If you are comfortable with Git, you can also fork this repository and commit your changes to your fork (instructions here).
Even if you are using our codespace you must have your own GitHub Copilot subscription; the codespace is linked to your GitHub account. If you are using a free GitHub account, you automatically get 120 free codespace core-hours per month. This 2 hour workshop should only use 4 core-hours.
Now that you have all the required software and materials, you need to open the code.
-
Open Visual Studio Code.
-
Click "Open Folder" in the Visual Studio Code welcome window.
-
Use the file navigator to find the GitHub-Copilot folder you downloaded from Github and click "Open".
-
Open up the
workshop.Rmd
file in thelessons
folder via the Files panel in Visual Studio Code (left-hand side). -
The
solutions
folder contains the solutions to the challenge problems. -
You will need to install the R extension in Visual Studio Code to run any R code and the Copilot extension to use Copilot, which we will walk through in the workshop. If you would like to install them beforehand check out the instructions here.
Check out the following resources to learn more about Visual Studio Code and GitHub Copilot:
D-Lab works with Berkeley faculty, research staff, and students to advance data-intensive social science and humanities research. Our goal at D-Lab is to provide practical training, staff support, resources, and space to enable you to use R for your own research applications. Our services cater to all skill levels and no programming, statistical, or computer science backgrounds are necessary. We offer these services in the form of workshops, one-to-one consulting, and working groups that cover a variety of research topics, digital tools, and programming languages.
Visit the D-Lab homepage to learn more about us. You can view our calendar for upcoming events, learn about how to utilize our consulting and data services, and check out upcoming workshops.
This repository was created with material from the codespacer GitHub template created by Anusha Bishop