Get startedGet started for free

Minimum wage by region

Looking at summary statistics of grouped data is a great way to learn about potential differences and similarities between the groups. Combine it with the @chain macro and you have nicely readable code!

In this exercise, you'll revisit the US minimum wage trends. As the 50 states plus Washington, D.C., is too much, you will look at the four regions of the United States - Northeast, Midwest, South, and West. The dataset has been loaded as wages.

Let's see how the different regions handle the minimum wage!

DataFrames, Statistics, Chain, and Plots packages have been loaded for you with the using keyword.

This exercise is part of the course

Data Manipulation in Julia

View Course

Exercise instructions

  • Create a chain macro on the wages DataFrame and save the result as regions_wage.
  • Inside the macro, group by region and year columns.
  • Calculate the median of effective_min_wage_2020_dollars and name the column median_effective_wage_2020.
  • Unstack the result so that the rows correspond to years, columns to regions, and values to the median wage.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Create the chain macro
regions_wage = ____

	# Group by region and year
    groupby(____)

	# Calculate the median wage per region per year
    combine(____)

	# Reshape the result
    ____
end

make_plot(regions_wage)
Edit and Run Code