Github Copilot: user thoughts from six months in

Adventures in using an AI-powered paired programming
code
analytics
programming
Published

January 15, 2025

GitHub Copilot is a coding assistant that helps programmers write code faster. It provides code completions and suggests code that you may want to write, all within an integrated development environment that a coder is using. I most frequently use the Copilot plug-in available in RStudio, but it’s available in all of the popular IDEs used by programmers and data scientists.

I pay 10 dollars a month for the Pro service, but Github has announced a free version that’s now available. I’ve been using it for about six months. It it worth the 10 dollars I pay? Absolutely. Here are a few use cases I typically use it for and some of the strengths and warnings with it.

Code completions rule.

The code completions that Github Copilot can do are usually accurate and save typing time. And these code completions aren’t just the “intellisense” completions that can complete a word, but they can write entire chunks of code. For example, if you want to calculate the standard error of the DBH variable and type se_dbh =, it will likely provide the ghost text se_dbh = sd_dbh / sqrt(n_dbh).

Github Copilot suggests code completions based on the active file being worked on. The more code, both in terms of lines and diversity of the functions being used, the better the code suggestions. In RStudio, you can also change settings to draw from code available in the same project from which you’re working.

Text to code is a time saver.

Github Copilot can write code based on a text prompt, one of its common uses. In RStudio, you can use the hashtag followed by what you want to do. For example, the following prompt will calculate the crown ratio of a tree.

# Write a function to predict the crown ratio of a tree based on it height and height to crown base.

This produces the following function and example usage:

predict_crown_ratio <- function(tree_height, height_to_crown_base) {
  # Check for valid inputs
  if (tree_height <= 0) {
    stop("Tree height must be greater than zero.")
  }
  if (height_to_crown_base < 0) {
    stop("Height to crown base must be non-negative.")
  }
  if (height_to_crown_base >= tree_height) {
    stop("Height to crown base must be less than tree height.")
  }
  
  # Calculate crown length and crown ratio
  crown_length <- tree_height - height_to_crown_base
  crown_ratio <- crown_length / tree_height
  return(crown_ratio)
}

# Example usage:
tree_height <- 30.0  # in meters
height_to_crown_base <- 10.0  # in meters
crown_ratio <- predict_crown_ratio(tree_height, height_to_crown_base)
cat("The crown ratio of the tree is:", round(crown_ratio, 2), "\n")
The crown ratio of the tree is: 0.67 

This task can save time and allow the analyst to avoid copying/pasting from an AI tool like Microsoft Copilot or ChatGPT. You can be specific and list which packages and functions to use (and avoid). I often use the tidyverse suite of functions in R and will prompt it with statements like “Using dplyr, …” or “Using a workflow from the tidymodels workflow, …”

Coding with a WiFi connection now needed.

Writing code used to be a task that I could do offline when I wasn’t connected to the web. (Living in rural Maine with power outages common and a modest travel schedule makes working offline a prerequisite.) But now as I’ve come to rely on what Github Copilot offers, I’ve also realized that a constant connection to the web is needed for it to work.

Helps to learn new languages.

R is my go-to programming language. I’ve asked Github Copilot to write R code based on imputing code from another language. As one example, I’ve asked it to translate SQL code to R code based on code I’ve provided. Want to see how? Copy the SQL code found at the bottom of this page and prompt and AI tool to translate it to R or Python code.

This process can help experienced programmers in one language to learn a new language with minimal effort.

Beware it may bring bad habits.

I try to follow the rule that states “if you copy and paste more than twice, it’s time to write a function”. But sometimes Copilot prompts can deter against that. It’s happy to write long blocks of code that an experienced programmer would never write, favoring parsimonious code chunks and the use of functions. In other words, it can trick you into poor coding hygiene.

Still learning how to code? Stay away.

I’ve listened and read different perspectives on who should be using AI coding assistants like Github Copilot. I generally agree with those that argue that if you’re a beginner, stay away from using AI tools until you have a solid foundation in coding skills. If you’re learning a new written language, you don’t learn it by copying someone elses words and trying to write a novel in the new language. Instead, you speak the language, have conversations in that language, and slowly learn the grammar and spelling to form written sentences.

As always, AI tools get things wrong, so tread carefully.

By Matt Russell. For more, subscribe to my monthly email newsletter to stay ahead on data and analytics trends in the forest products industry.