HW 3 Rubric
Rubric
This is the rubric for AI feedback, not necessarily the rubric for grading.
Part 1
Question 1
Part a - Code uses
glimpse()to inspectcountry_inflation.Part a - Narrative reports 38 rows and 34 columns.
Part a - Narrative states that each row represents a country.
Part a - Narrative explains that
countrycontains country names and the remaining columns contain annual inflation rates for 1993 through 2025.Part b - Code identifies distinct countries with
distinct()or an equivalent approach.Part b - Output displays all 38 country names without truncation.
Part b - Narrative reports 38 distinct countries.
Code style and readability: line breaks after each |>, appropriate indentation, spaces around equals signs if they are present, and spaces after commas.
- Note: Indentation with two spaces, four spaces, or tabs is acceptable.
Question 2
Part a - Code selects the
countryand2024columns.Part a - Code arranges inflation rates in descending order and retains the top three countries.
Part a - Output has three rows and two columns, showing Türkiye, Colombia, and Iceland with their correct 2024 inflation rates.
Part b - Response correctly identifies the US inflation rate as approximately 2.95%.
Part b - Narrative compares the inflation rates of all three countries to the US rate, correctly describing Türkiye’s rate as about 20 times, Colombia’s as over twice, and Iceland’s as almost twice the US rate. Equivalent accurate comparisons are acceptable.
Narrative consistently refers to 2024 and correctly names the countries.
Code style and readability: line breaks after each |>, appropriate indentation, spaces around equals signs if they are present, and spaces after commas.
- Note: Indentation with two spaces, four spaces, or tabs is acceptable.
Question 3
Part a - Code uses a single pipeline starting with
country_inflation.Part a - Code retains only countries with nonmissing inflation data for both 1993 and 2025.
Part a - Code creates
inf_ratioas2025divided by1993.Part a - Code selects only
countryandinf_ratio, in that order.Part a - Code saves the result as
country_inflation_ratios.Part b - A separate pipeline displays the data in ascending order of
inf_ratio.Part b - A separate pipeline displays the data in descending order of
inf_ratio.Part c - Narrative identifies New Zealand and correctly describes its ratio of approximately 2.20 or increase of about 120%.
Part d - Narrative identifies Lithuania and correctly describes its ratio of approximately 0.00924 or decrease of about 99.1%.
Code style and readability: line breaks after each |>, appropriate indentation, spaces around equals signs if they are present, and spaces after commas.
- Note: Indentation with two spaces, four spaces, or tabs is acceptable.
Question 4
Code uses
pivot_longer()to reshape the year columns while retainingcountryas an identifier.The resulting data frame has one row per country/year combination, with separate columns for country, year, and annual inflation.
The pivoting function converts the year variable to numeric.
Code saves the result with a new, short, informative name without overwriting
country_inflation.Code displays the resulting data frame.
Narrative correctly reports 1,254 rows and 3 columns and names the resulting columns.
Narrative states that each row represents a country/year combination.
Code style and readability: line breaks after each |>, appropriate indentation, spaces around equals signs if they are present, and spaces after commas.
- Note: Indentation with two spaces, four spaces, or tabs is acceptable.
Question 5
Each part uses a separate, single pipeline starting with the pivoted dataset.
Part a - Code uses
filter()withmax()to identify the highest inflation rate.Part a - Output has one row and three columns, and the narrative identifies Lithuania in 1993 with an inflation rate of approximately 410%.
Part b - Code uses
filter()withmin()to identify the lowest inflation rate.Part b - Output has one row and three columns, and the narrative identifies Ireland in 2009 with an inflation rate of approximately -4.45%.
Code handles missing inflation values appropriately when calculating the minimum and maximum.
Part c - Code uses
filter()to retain both extremes, producing two rows and three columns.Code style and readability: line breaks after each |>, appropriate indentation, spaces around equals signs if they are present, and spaces after commas.
- Note: Indentation with two spaces, four spaces, or tabs is acceptable.
Question 6
Part a - Code creates
countries_of_interestwith one to five country names that match the dataset.Part a - Narrative explains why these countries were selected.
Part b - A single pipeline correctly filters the pivoted data for the selected countries and saves the result with a new, short, informative name.
Part b - A separate pipeline uses
distinct()to display the selected countries, matching the vector from Part a.Part c - Plot uses the filtered data, with year on the x-axis and annual inflation on the y-axis.
Part c - Plot displays points and lines connecting observations for each country.
Part c - Countries have distinct colors for both lines and points and distinct point shapes.
Part c - Plot has an informative title and human-readable axis and legend labels, including inflation units.
Part c - Plot includes at least one customization, and the narrative explains how it was customized.
Part d - Narrative accurately compares patterns across countries and discusses what is surprising or unsurprising in light of the student’s knowledge.
Code style and readability: line breaks after each |> and +, appropriate indentation, spaces around equals signs if they are present, and spaces after commas.
- Note: Indentation with two spaces, four spaces, or tabs is acceptable.
Part 2
Question 7
Part a - Narrative reports 168 rows and 4 columns.
Part a - Narrative names
country,cpi_expenditure_id,year, andannual_inflation.Part a - Narrative states that the data span 2011–2024.
Part b - Narrative reports 12 rows and 2 columns and names
idanddescription.Part c - Code uses an appropriate join to attach expenditure descriptions to the inflation observations.
Part c - Code specifies the matching keys using
join_by(cpi_expenditure_id == id)or the equivalent with reversed table order.Part c - Code saves the joined dataset with a new, short, informative name without overwriting either input.
Part c - Narrative reports 168 rows and 5 columns.
Part c - Narrative correctly names the joined dataset’s five columns.
Code style and readability: line breaks after each |>, appropriate indentation, spaces around equals signs if they are present, and spaces after commas.
- Note: Indentation with two spaces, four spaces, or tabs is acceptable.
Question 8
Part a - Code creates
expenditures_of_interestcontaining one to five valid expenditure IDs or descriptions.Part a - Narrative explains why these expenditures were selected.
Part b - Code uses a single pipeline starting with the joined dataset.
Part b - Code correctly filters for all selected expenditures using
%in%or an equivalent approach.Part b - Code saves the filtered dataset with a new, short, informative name without overwriting the joined dataset.
Part b - A separate pipeline uses
distinct()to display the expenditures in the filtered dataset.Part b - The displayed expenditures match those selected in Part a.
Code style and readability: line breaks after each |>, appropriate indentation, spaces around equals signs if they are present, and spaces after commas.
- Note: Indentation with two spaces, four spaces, or tabs is acceptable.
Question 9
Plot uses the filtered dataset from Question 8.
Code maps
yearto the x-axis andannual_inflationto the y-axis.Plot displays points and lines connecting observations for each expenditure.
Expenditures have distinct colors for both lines and points.
Expenditures have distinct point shapes.
Plot has human-readable axis and legend labels, including inflation units.
Plot has an informative title and/or subtitle.
Plot includes at least one customization, such as a nondefault theme, color scale, or legend placement.
Narrative accurately compares patterns across expenditures and discusses what is surprising or unsurprising in light of the student’s knowledge.
Code style and readability: line breaks after each |> and +, appropriate indentation, spaces around equals signs if they are present, and spaces after commas.
- Note: Indentation with two spaces, four spaces, or tabs is acceptable.