Activity #1

Step 1

Read the question and the sample student answer and provide feedback to the student.

Question

For this question you will work with inflation data from various countries in the world over the last 30 years. The dataset is called country-inflation.csv and it’s in your data folder. Below is a peek at the data.


Reshape (pivot) country_inflation such that each row represents a country/year combination, with columns country, year, and annual_inflation. Then, display the resulting data frame and state how many rows and columns it has.

Sample answer

country_inflation <- read_csv("data/country-inflation.csv")

There are 3 columns and 1178 rows in this new data frame.

df <- country_inflation |> 
    pivot_longer(
    cols = -country,names_to = "year", 
    values_to = "inflationrate"
               )
print(df)
# A tibble: 1,178 × 3
   country   year  inflationrate
   <chr>     <chr>         <dbl>
 1 Australia 1993          1.75 
 2 Australia 1994          1.97 
 3 Australia 1995          4.63 
 4 Australia 1996          2.62 
 5 Australia 1997          0.225
 6 Australia 1998          0.860
 7 Australia 1999          1.48 
 8 Australia 2000          4.46 
 9 Australia 2001          4.41 
10 Australia 2002          2.98 
# ℹ 1,168 more rows

Step 2

Practice using LLMs to generate feedback for students using your favorite LLM (Chat GPT, Anthropic, Perplexity, etc.) and the question and the sample student answer alone.

Step 3

Practice using LLMs to generate feedback for students using your favorite LLM (Chat GPT, Anthropic, Perplexity, etc.) and the question, the sample student answer, and the rubric.

Rubric

  • Code uses pivot_longer().

  • Code names the data frame something short and informative.

  • Code names the year variable year and the inflation variable annual_inflation.

  • Code transforms the year variable to numeric inside pivot_longer().

  • Output displays country_inflation_longer.

  • Output has 3 columns: country, year, and annual_inflation.

  • Narrative states the correct numbers of rows and columns.

  • Code style and readability: Line breaks after each |>, proper indentation, spaces around = signs if they are present, and spaces after commas if they are present.

Step 4

Practice using LLMs to generate feedback for students using your favorite LLM (Chat GPT, Anthropic, Perplexity, etc.) and the question, the sample student answer, the rubric, and a customized prompt.