Introduction

The Big Mac Price dataset contains information on Big Mac prices across countries around the world from April 2000 through July 2022. The dataset includes information such as the country, currency code, local price, exchange rate, and the price converted into U.S. dollars. For this analysis, I primarily focused on the dollar price because converting prices into the same currency makes comparisons between countries much easier.

I chose this dataset because the Big Mac is a familiar product that is sold in many different countries, making it interesting to see how the price of essentially the same product can vary depending on location and time. The goal of my analysis is to examine how Big Mac prices have changed over time and how prices compare across the different countries.

Dataset

Before creating the visualizations, I looked at some basic descriptive statistics to better understand the dataset.

descriptive_stats <- df %>%
  summarise(
    Total_Observations = n(),
    Number_of_Countries = n_distinct(name),
    Average_Price = mean(dollar_price, na.rm = TRUE),
    Median_Price = median(dollar_price, na.rm = TRUE),
    Minimum_Price = min(dollar_price, na.rm = TRUE),
    Maximum_Price = max(dollar_price, na.rm = TRUE)
  )

descriptive_stats
##   Total_Observations Number_of_Countries Average_Price Median_Price
## 1               1946                  74      3.568011          3.4
##   Minimum_Price Maximum_Price
## 1             0         11.25

The dataset contains 1,946 observations representing 74 different countries. The average Big Mac price across all observations was about $3.57, while the median price was $3.40. The highest recorded price was $11.25.

The observations range from April 2000 through July 2022, covering more than twenty years of Big Mac pricing data. The descriptive statistics show that there is a considerable amount of variation in Big Mac prices across the dataset. ## Findings {.tabset .tabset-fade .tabset-pills}

The following five visualizations examine Big Mac prices from several different perspectives. The analysis begins by looking at changes in the United States before expanding to comparisons between countries, currencies, and years.

U.S. Price Over Time

us_data <- df[df$currency_code == "USD", ]

ggplot(us_data, aes(x = date, y = dollar_price)) +
  geom_line(color = "red", linewidth = 1.2) +
  geom_point(color = "gold", size = 3) +
  scale_x_date(date_breaks = "3 years", date_labels = "%Y") +
  labs(
    title = "Big Mac Price in the US Over Time",
    x = "Year",
    y = "Big Mac Price (USD)"
  ) +
  theme_minimal()

The first graph looks specifically at how the price of a Big Mac changed in the United States from 2000 through 2022. I wanted to begin with the United States because the rest of the dataset converts prices into U.S. dollars, making the U.S. a useful starting point for the analysis.

The graph shows a clear upward trend over time. The price begins at a little over $2 in 2000 and eventually rises above $5 by the end of the dataset. While there are periods where the price remains pretty stable, the overall direction is clearly upward. This graph provides a useful baseline before comparing the United States with other countries.

Highest Recorded Prices

highest_prices <- df %>%
  group_by(currency_code) %>%
  slice_max(dollar_price, n = 1, with_ties = FALSE) %>%
  ungroup()

top10_prices <- highest_prices %>%
  arrange(desc(dollar_price)) %>%
  slice_head(n = 10)

ggplot(top10_prices,
       aes(x = reorder(currency_code, dollar_price),
           y = dollar_price)) +
  geom_col(fill = "red") +
  geom_text(
    aes(label = substr(date, 1, 4)),
    hjust = -0.3,
    size = 4,
    color = "gold"
  ) +
  labs(
    title = "Top 10 Highest Recorded Big Mac Prices",
    subtitle = "Year of highest recorded price shown next to each bar",
    x = "Currency Code",
    y = "Big Mac Price (USD)"
  ) +
  coord_flip() +
  theme_minimal()

The second graph expands the analysis beyond the United States by displaying the ten highest recorded Big Mac prices by currency. I originally considered displaying every currency in the dataset, but limiting the visualization to the ten highest values makes the differences much easier to interpret.

The year next to each bar identifies when that currency reached its highest recorded Big Mac price. The graph demonstrates that Big Mac prices can differ considerably between currencies. It also shows that the highest recorded prices did not necessarily occur during the same year, suggesting that the differences are influenced by more than simply the general increase in prices over time. ### Country Trends

selected_countries <- df %>%
  filter(name %in% c(
    "United States",
    "Britain",
    "Canada",
    "Australia",
    "Japan",
    "Switzerland"
  ))

ggplot(selected_countries, aes(x = date, y = dollar_price)) +
  geom_line(color = "red", linewidth = 1.2) +
  facet_wrap(~ name, ncol = 2) +
  scale_x_date(
    date_breaks = "5 years",
    date_labels = "%Y"
  ) +
  labs(
    title = "Big Mac Prices Over Time Across Selected Countries",
    subtitle = "Comparing prices in U.S. dollars",
    x = "Year",
    y = "Big Mac Price (USD)"
  ) +
  theme_minimal() +
  theme(
    plot.title = element_text(face = "bold", size = 16),
    plot.subtitle = element_text(size = 11),
    strip.text = element_text(face = "bold", size = 11),
    panel.grid.minor = element_blank(),
    axis.text.x = element_text(size = 8)
  )

The third graph uses a trellis chart to compare Big Mac price trends in Australia, Britain, Canada, Japan, Switzerland, and the United States. Separating each country into its own section makes the trends easier to compare without placing six different lines on the same graph.

Australia, Canada, and the United States all show noticeable increases over time, while Switzerland remains relatively high and stable throughout much of the period. Japan stands out because its price fluctuates more noticeably and does not follow the same consistent upward pattern as several of the other countries. This visualization shows that even though Big Mac prices generally increased over time, the pattern was not identical in every country. ### Latest Prices

latest_prices <- df %>%
  group_by(name) %>%
  slice_max(order_by = date, n = 1, with_ties = FALSE) %>%
  ungroup() %>%
  arrange(desc(dollar_price)) %>%
  slice_head(n = 15)

ggplot(latest_prices,
       aes(x = reorder(name, dollar_price),
           y = dollar_price)) +
  geom_col(fill = "red", width = 0.7) +
  geom_text(
    aes(label = paste0("$", round(dollar_price, 2))),
    hjust = -0.15,
    color = "goldenrod",
    size = 3
  ) +
  coord_flip(clip = "off") +
  scale_y_continuous(
    limits = c(0, 8),
    breaks = seq(0, 8, 2)
  ) +
  labs(
    title = "Top 15 Most Expensive Big Macs",
    subtitle = "Latest available price by country",
    x = NULL,
    y = "Price (USD)"
  ) +
  theme_minimal() +
  theme(
    plot.title = element_text(face = "bold", size = 15),
    plot.subtitle = element_text(size = 10),
    axis.text.y = element_text(size = 9),
    axis.text.x = element_text(size = 8),
    axis.title.x = element_text(size = 10),
    panel.grid.major.y = element_blank(),
    panel.grid.minor = element_blank(),
    plot.margin = margin(5.5, 25, 5.5, 5.5)
  )

The fourth graph looks at the fifteen most expensive Big Macs based only on the latest available observation for each country. This is different from the second graph because that visualization looked at the highest price ever recorded, while this graph provides a better picture of prices toward the end of the dataset.

New Zealand has the highest latest price at approximately $7, followed by Norway, Canada, and Australia. The United States appears near the bottom of the top fifteen at $5.15. This was interesting because it shows that even though the United States is being used as the common currency for comparison, it is not necessarily one of the most expensive places to purchase a Big Mac. ### Price Heatmap

# Make sure date is formatted correctly
df$date <- as.Date(df$date)

# Create heatmap dataset
heatmap_data <- df %>%
  mutate(year = as.numeric(format(date, "%Y"))) %>%
  filter(name %in% c(
    "United States",
    "Britain",
    "Canada",
    "Australia",
    "Japan",
    "Switzerland"
  )) %>%
  group_by(name, year) %>%
  summarise(
    avg_price = mean(dollar_price, na.rm = TRUE),
    .groups = "drop"
  )

# Check the data
print(heatmap_data)
## # A tibble: 138 × 3
##    name       year avg_price
##    <chr>     <dbl>     <dbl>
##  1 Australia  2000      2.59
##  2 Australia  2001      3   
##  3 Australia  2002      3   
##  4 Australia  2003      3   
##  5 Australia  2004      3.25
##  6 Australia  2005      3.25
##  7 Australia  2006      3.25
##  8 Australia  2007      3.45
##  9 Australia  2008      3.45
## 10 Australia  2009      4.34
## # ℹ 128 more rows
# Create heatmap
ggplot(heatmap_data,
       aes(x = year,
           y = name,
           fill = avg_price)) +
  
  geom_tile(
    color = "white",
    linewidth = 0.5
  ) +
  
  scale_fill_gradient(
    low = "brown",
    high = "green",
    name = "Price (USD)"
  ) +
  
  scale_x_continuous(
    breaks = seq(2000, 2022, 2)
  ) +
  
  labs(
    title = "Big Mac Prices Across Countries and Time",
    subtitle = "Average annual Big Mac price in U.S. dollars",
    x = "Year",
    y = NULL
  ) +
  
  theme_minimal() +
  
  theme(
    plot.title = element_text(
      face = "bold",
      size = 15
    ),
    plot.subtitle = element_text(
      size = 10
    ),
    axis.text.x = element_text(
      angle = 45,
      hjust = 1,
      size = 8
    ),
    axis.text.y = element_text(
      size = 10
    ),
    panel.grid = element_blank()
  )

The final graph uses a heatmap to combine country, year, and price into one visualization. Each row represents a country, each column represents a year, and the color represents the average Big Mac price in U.S. dollars. I changed the color scale to resemble the colors of a burger and lettuce while also making differences in price easier to identify.

The heatmap reinforces several patterns from the trellis chart. Canada and Australia become noticeably higher-priced toward the later years, while Switzerland remains consistently expensive throughout the dataset. Japan shows a different pattern, with its prices increasing and decreasing at different points in time. Using color rather than lines provides another way to quickly identify how prices differ across both countries and years.

Conclusion

Overall, the Big Mac dataset shows that the price of the same general product can vary significantly depending on both time and location. The United States experienced a clear increase in price between 2000 and 2022, but the international comparisons showed that countries did not all follow the same pattern. Some countries experienced relatively steady increases, while others showed more fluctuation. The latest observations also showed that several countries had Big Mac prices noticeably higher than the United States.

Using five different visualizations helped reveal different parts of the dataset. The line graph was useful for showing change over time, the bar graphs made rankings and comparisons easier to understand, the trellis chart allowed multiple countries to be examined without overcrowding one graph, and the heatmap provided a broader view of price differences across both countries and years. Overall, my analysis showed how different visualization techniques can be used together to tell a more complete story from one dataset.