# download the happiness data
download.file(url = "https://github.com/jcooperstone/dataviz-site/raw/refs/heads/master/2_04_wrangling/data/hapiscore_whr.csv",
              destfile = "happiness.csv")Wrangling and plotting with Copilot

1 Introduction
We are going to continue playing around today with wrangling and plotting with the help of GitHub Copilot in RStudio.
1.1 Loading data
I want to pick some data that has a bunch of dimensions so we can ask some interesting questions. Let’s use a dataset we’ve used before, gapminder and I’ve created some files for you to download.
Remember that files with by default be downloaded into your working directory.
Here is some code to download a file that includes information about the happiness score for each country in the world from 2005-2022.
And some data on life expectancy around the world from 1800 to predicted values from 2022-2100.
# download the life expectancy data
download.file(url = "https://github.com/jcooperstone/dataviz-site/raw/refs/heads/master/2_04_wrangling/data/life_expectancy.csv",
              destfile = "life-expectancy.csv")2 Tasks to play around with
Let’s together work on writing prompts to get R to write to complete each tasks or that answer the following questions:
Get R to read in your happiness and life expectancy data
Understand what your data contains
Which is the country with the highest life expectancy in 2025?
Which country increased life expectancy the most from 2000 to 2025?
Create a plot that shows the line expectancy in the United States over the time period for which we have data
Create a plot that shows the relationship between life expectancy and happiness score in 2022.