TidyTuesday 09/16/2025

TidyTuesday Section (optional)

Instructions

You can count work on this week’s TidyTuesday toward the exceptional work required for an A in the Homework component.

Explore the week’s TidyTuesday challenge. Develop a research question, then answer it through a short data story with effective visualization(s). Provide sufficient background for readers to grasp your narrative.

Code
#Necessary Libraries
#| include: false
#| echo: false

library(readxl)
library(dplyr)
library(tidyverse)
library(hrbrthemes)
library(viridis)
library(tidytuesdayR)
library(stringr)
library(patchwork)

##Importing the Data

Reading in the Tidytuesday data for last week, which takes a look at recipes gathered Allrecipes.com. The first data set – all_recipes – has a collection of regular recipes and the second data set – cuisines – contains recipes organized by their country of origin, and has fewer data points than the all_recipies data set.

Code
tt_data <- tt_load("2025-09-16")
all_recipes <- tt_data$all_recipes
cuisines <- tt_data$cuisines

Research Questions: What recipe takes the longest and what is the fastest? Does a certain cuisine take longer than others, how much of it is prep vs cook time?

Exploring the Data

Code
#Joining the Data 
recipes_expanded <- full_join(all_recipes, cuisines)

#Finding recipe with longest total time

Code
recipes_expanded |> 
  slice_max(total_time, with_ties = TRUE)
# A tibble: 1 × 17
  name      url   author date_published ingredients calories   fat carbs protein
  <chr>     <chr> <chr>  <date>         <chr>          <dbl> <dbl> <dbl>   <dbl>
1 Homemade… http… MSGYP… 2023-06-27     4 cups sug…       NA    NA    NA      NA
# ℹ 8 more variables: avg_rating <dbl>, total_ratings <dbl>, reviews <dbl>,
#   prep_time <dbl>, cook_time <dbl>, total_time <dbl>, servings <dbl>,
#   country <chr>

The recipe that takes the longest is homemade wine, which funnily enough has only 5 min prep time and 0 cook time but needs to ferment for about 42 days. It does make 32 servings though, probably for a wine tasting party.

#Finding recipe with shortest total time

Code
recipes_expanded |> 
  filter(total_time == 1) #over 300 had cooking times of zero, which was most likely put in place because no time was given, which is why I started with == to 1.
# A tibble: 4 × 17
  name      url   author date_published ingredients calories   fat carbs protein
  <chr>     <chr> <chr>  <date>         <chr>          <dbl> <dbl> <dbl>   <dbl>
1 Pumpkin … http… Penny  2022-09-16     ¼ cup grou…       22     1     5       0
2 Teriyaki… http… Judy   2022-08-08     ⅔ cup soy …       43    NA     8       2
3 3-Ingred… http… IBNSH… 2025-06-05     1 tablespo…       17     1     1       1
4 Sauteed … http… theda… 2025-02-03     2 tablespo…       80     6     4       2
# ℹ 8 more variables: avg_rating <dbl>, total_ratings <dbl>, reviews <dbl>,
#   prep_time <dbl>, cook_time <dbl>, total_time <dbl>, servings <dbl>,
#   country <chr>

The 4 recipies that take the “shortest” amount of time are all sauces/spice mixes. Pumpkin pie spice and 3 ingredient Potsticker dip, do sound like they would take minimal prep time which is why their authors have most likely just marked the time as 1 minute. However teriyaki sauce and sauteed oyster mushrooms in garlic butter sound like they might take more time in reality. Since these are user entered – volunteer data – there doens’t have to be accuracy for reporting, which is most likely why these recipes show up here. It is important to then understand that user error might be a serious bias skewing or limited analysis.

#Cusine with longest average time

Code
cuisines |> 
  group_by(country) |> 
  summarise(Mean_time = mean(total_time)) |> 
  arrange(desc(Mean_time))
# A tibble: 49 × 2
   country             Mean_time
   <chr>                   <dbl>
 1 Amish and Mennonite      849.
 2 Turkish                  353.
 3 Portuguese               353.
 4 Canadian                 271.
 5 German                   270.
 6 Korean                   263.
 7 Belgian                  245 
 8 Russian                  239.
 9 Jamaican                 225.
10 Jewish                   218.
# ℹ 39 more rows

It appears Amish and Mennonite food takes the longest to make, most likely because they do things more traditionally and preserve a lot of food which takes time. In comparison on average Colombian food takes the least average amount of time. A lot of the mean times however are quite long because they are most likely being skewed by a few large data points or recipes that take a long time.

Visualizations

#Prepping the Data for the Visualization

Code
Mean_times_cuisines <-  cuisines |> 
  mutate(other_time = (total_time - (prep_time + cook_time))) |> 
  group_by(country) |> 
  summarise(mean_prep_time = mean(prep_time), mean_cook_time = mean(cook_time), mean_other_time = mean(other_time)) |> 
  pivot_longer(
    cols = c(mean_prep_time, mean_cook_time, mean_other_time),
    names_to = "work_type", 
    values_to = "time_dedicated"
  ) |> 
  group_by(country) |> 
  mutate(percent = time_dedicated/sum(time_dedicated)) |> 
  ungroup(country)
Code
Overall_times_recipies <-  recipes_expanded |> 
  mutate(other_time = (total_time - (prep_time + cook_time))) |> 
  summarise(mean_prep_time = mean(prep_time), mean_cook_time = mean(cook_time), mean_other_time = mean(other_time)) |> 
  pivot_longer(
    cols = c(mean_prep_time, mean_cook_time, mean_other_time),
    names_to = "work_type", 
    values_to = "time_dedicated"
  ) |> 
  mutate(percent = time_dedicated/sum(time_dedicated))

#Vizualization

Code
Overall_times_recipies |> 
  ggplot(aes(x = "", y = time_dedicated, group = work_type, colour = work_type, fill = work_type)) + 
  geom_bar(width = 1, stat = "identity") + 
  coord_polar("y", start = 0) + 
  geom_text(aes( x = 1.7, label = paste0(round(percent*100), "%")),
                color = "black", position = position_stack(vjust = 0.5)) + 
  theme_void() + 
  scale_color_viridis_d(labels = c("mean_cook_time" = "Cooking", "mean_other_time" = "Other", "mean_prep_time" = "Prep")) + 
  scale_fill_viridis_d(labels = c("mean_cook_time" = "Cooking", "mean_other_time" = "Other", "mean_prep_time" = "Prep")) + 
  labs(fill = "Type of work", colour = "Type of work", title = "Average percent of cooking time dedicated to each task")  

This graphs shows for all recipes the amount of time dedicated to each type of task for cooking. As we can see here the majority of time is in fact in the “other” category, which is often a longer period of time of letting the dish sit to either cool or rise or ferment, etc. Prep takes the least time out of total cooking time as it is often just cutting something up, which is an easy task. Cooking often involves heat and takes a bit longer. It is possible this pie chart is skewed by data points mentioned above, like the homemade wine where it has to ferment for 42 days.

#Spliting into groups of 4 to vizualize

Code
Mean_times_cuisines_A <- Mean_times_cuisines |> 
  filter(str_detect(country, "^A"))
Code
Pies_A <- Mean_times_cuisines_A |> 
  ggplot(aes(x = "", y = percent, group = work_type, colour = work_type, fill = work_type)) + 
  geom_bar(width = 1, stat = "identity") +
  coord_polar("y", start=0) + 
  facet_grid(.~country) +
  theme_void() + 
  scale_color_viridis_d(labels = c("mean_cook_time" = "Cooking", "mean_other_time" = "Other", "mean_prep_time" = "Prep")) + 
  scale_fill_viridis_d(labels = c("mean_cook_time" = "Cooking", "mean_other_time" = "Other", "mean_prep_time" = "Prep")) + 
  labs(fill = "Type of work", colour = "Type of work") + 
  theme(
    axis.line = element_blank(),
      axis.title = element_blank(),
      axis.text = element_blank(),
      axis.ticks = element_blank(),
      axis.ticks.length = unit(0, "pt")
    )
Code
Mean_times_cuisines_B <- Mean_times_cuisines |> 
  filter(str_detect(country, "^B|^Caj"))
Code
Pies_B <- Mean_times_cuisines_B |> 
  ggplot(aes(x = "", y = percent, group = work_type, colour = work_type, fill = work_type)) + 
  geom_bar(width = 1, stat = "identity") +
  coord_polar("y", start=0) + 
  facet_grid(.~country) +
  theme_void() + 
  scale_color_viridis_d(labels = c("mean_cook_time" = "Cooking", "mean_other_time" = "Other", "mean_prep_time" = "Prep")) + 
  scale_fill_viridis_d(labels = c("mean_cook_time" = "Cooking", "mean_other_time" = "Other", "mean_prep_time" = "Prep")) + 
  labs(fill = "Type of work", colour = "Type of work") + 
  theme(
    axis.line = element_blank(),
      axis.title = element_blank(),
      axis.text = element_blank(),
      axis.ticks = element_blank(),
      axis.ticks.length = unit(0, "pt")
    )
Code
Mean_times_cuisines_C <- Mean_times_cuisines |> 
  filter(str_detect(country, "^Can|^Ch|Co"))
Code
Pies_C <- Mean_times_cuisines_C |> 
  ggplot(aes(x = "", y = percent, group = work_type, colour = work_type, fill = work_type)) + 
  geom_bar(width = 1, stat = "identity") +
  coord_polar("y", start=0) + 
  facet_grid(.~country) +
  theme_void() + 
  scale_color_viridis_d(labels = c("mean_cook_time" = "Cooking", "mean_other_time" = "Other", "mean_prep_time" = "Prep")) + 
  scale_fill_viridis_d(labels = c("mean_cook_time" = "Cooking", "mean_other_time" = "Other", "mean_prep_time" = "Prep")) + 
  labs(fill = "Type of work", colour = "Type of work") + 
  theme(
    axis.line = element_blank(),
      axis.title = element_blank(),
      axis.text = element_blank(),
      axis.ticks = element_blank(),
      axis.ticks.length = unit(0, "pt")
    )
Code
Mean_times_cuisines_D <- Mean_times_cuisines |> 
  filter(str_detect(country, "^Cu|^D|^Fil"))
Code
Pies_D <- Mean_times_cuisines_D |> 
  ggplot(aes(x = "", y = percent, group = work_type, colour = work_type, fill = work_type)) + 
  geom_bar(width = 1, stat = "identity") +
  coord_polar("y", start=0) + 
  facet_grid(.~country) +
  theme_void() + 
  scale_color_viridis_d(labels = c("mean_cook_time" = "Cooking", "mean_other_time" = "Other", "mean_prep_time" = "Prep")) + 
  scale_fill_viridis_d(labels = c("mean_cook_time" = "Cooking", "mean_other_time" = "Other", "mean_prep_time" = "Prep")) + 
  labs(fill = "Type of work", colour = "Type of work") + 
  theme(
    axis.line = element_blank(),
      axis.title = element_blank(),
      axis.text = element_blank(),
      axis.ticks = element_blank(),
      axis.ticks.length = unit(0, "pt")
    )
Code
Mean_times_cuisines_E <- Mean_times_cuisines |> 
  filter(str_detect(country, "^Fin|^Fr|^G"))
Code
Pies_E <- Mean_times_cuisines_E |> 
  ggplot(aes(x = "", y = percent, group = work_type, colour = work_type, fill = work_type)) + 
  geom_bar(width = 1, stat = "identity") +
  coord_polar("y", start=0) + 
  facet_grid(.~country) +
  theme_void() + 
  scale_color_viridis_d(labels = c("mean_cook_time" = "Cooking", "mean_other_time" = "Other", "mean_prep_time" = "Prep")) + 
  scale_fill_viridis_d(labels = c("mean_cook_time" = "Cooking", "mean_other_time" = "Other", "mean_prep_time" = "Prep")) + 
  labs(fill = "Type of work", colour = "Type of work") + 
  theme(
    axis.line = element_blank(),
      axis.title = element_blank(),
      axis.text = element_blank(),
      axis.ticks = element_blank(),
      axis.ticks.length = unit(0, "pt")
    )
Code
Mean_times_cuisines_F <- Mean_times_cuisines |> 
  filter(str_detect(country, "^I"))
Code
Pies_F <- Mean_times_cuisines_F |> 
  ggplot(aes(x = "", y = percent, group = work_type, colour = work_type, fill = work_type)) + 
  geom_bar(width = 1, stat = "identity") +
  coord_polar("y", start=0) + 
  facet_grid(.~country) +
  theme_void() + 
  scale_color_viridis_d(labels = c("mean_cook_time" = "Cooking", "mean_other_time" = "Other", "mean_prep_time" = "Prep")) + 
  scale_fill_viridis_d(labels = c("mean_cook_time" = "Cooking", "mean_other_time" = "Other", "mean_prep_time" = "Prep")) + 
  labs(fill = "Type of work", colour = "Type of work") + 
  theme(
    axis.line = element_blank(),
      axis.title = element_blank(),
      axis.text = element_blank(),
      axis.ticks = element_blank(),
      axis.ticks.length = unit(0, "pt")
    )
Code
Mean_times_cuisines_G <- Mean_times_cuisines |> 
  filter(str_detect(country, "^J|^K"))
Code
Pies_G <- Mean_times_cuisines_G |> 
  ggplot(aes(x = "", y = percent, group = work_type, colour = work_type, fill = work_type)) + 
  geom_bar(width = 1, stat = "identity") +
  coord_polar("y", start=0) + 
  facet_grid(.~country) +
  theme_void() + 
  scale_color_viridis_d(labels = c("mean_cook_time" = "Cooking", "mean_other_time" = "Other", "mean_prep_time" = "Prep")) + 
  scale_fill_viridis_d(labels = c("mean_cook_time" = "Cooking", "mean_other_time" = "Other", "mean_prep_time" = "Prep")) + 
  labs(fill = "Type of work", colour = "Type of work") + 
  theme(
    axis.line = element_blank(),
      axis.title = element_blank(),
      axis.text = element_blank(),
      axis.ticks = element_blank(),
      axis.ticks.length = unit(0, "pt")
    )
Code
Mean_times_cuisines_H <- Mean_times_cuisines |> 
  filter(str_detect(country, "^L|^M|^N|^Pa"))
Code
Pies_H <- Mean_times_cuisines_H |> 
  ggplot(aes(x = "", y = percent, group = work_type, colour = work_type, fill = work_type)) + 
  geom_bar(width = 1, stat = "identity") +
  coord_polar("y", start=0) + 
  facet_grid(.~country) +
  theme_void() + 
  scale_color_viridis_d(labels = c("mean_cook_time" = "Cooking", "mean_other_time" = "Other", "mean_prep_time" = "Prep")) + 
  scale_fill_viridis_d(labels = c("mean_cook_time" = "Cooking", "mean_other_time" = "Other", "mean_prep_time" = "Prep")) + 
  labs(fill = "Type of work", colour = "Type of work") + 
  theme(
    axis.line = element_blank(),
      axis.title = element_blank(),
      axis.text = element_blank(),
      axis.ticks = element_blank(),
      axis.ticks.length = unit(0, "pt")
    )
Code
Mean_times_cuisines_I <- Mean_times_cuisines |> 
  filter(str_detect(country, "^Pe|^Po"))
Code
Pies_I <- Mean_times_cuisines_I |> 
  ggplot(aes(x = "", y = percent, group = work_type, colour = work_type, fill = work_type)) + 
  geom_bar(width = 1, stat = "identity") +
  coord_polar("y", start=0) + 
  facet_grid(.~country) +
  theme_void() + 
  scale_color_viridis_d(labels = c("mean_cook_time" = "Cooking", "mean_other_time" = "Other", "mean_prep_time" = "Prep")) + 
  scale_fill_viridis_d(labels = c("mean_cook_time" = "Cooking", "mean_other_time" = "Other", "mean_prep_time" = "Prep")) + 
  labs(fill = "Type of work", colour = "Type of work") + 
  theme(
    axis.line = element_blank(),
      axis.title = element_blank(),
      axis.text = element_blank(),
      axis.ticks = element_blank(),
      axis.ticks.length = unit(0, "pt")
    )
Code
Mean_times_cuisines_J <- Mean_times_cuisines |> 
  filter(str_detect(country, "^Pu|^R|^Sc|^Soul"))
Code
Pies_J <- Mean_times_cuisines_J |> 
  ggplot(aes(x = "", y = percent, group = work_type, colour = work_type, fill = work_type)) + 
  geom_bar(width = 1, stat = "identity") +
  coord_polar("y", start=0) + 
  facet_grid(.~country) +
  theme_void() + 
  scale_color_viridis_d(labels = c("mean_cook_time" = "Cooking", "mean_other_time" = "Other", "mean_prep_time" = "Prep")) + 
  scale_fill_viridis_d(labels = c("mean_cook_time" = "Cooking", "mean_other_time" = "Other", "mean_prep_time" = "Prep")) + 
  labs(fill = "Type of work", colour = "Type of work") + 
  theme(
    axis.line = element_blank(),
      axis.title = element_blank(),
      axis.text = element_blank(),
      axis.ticks = element_blank(),
      axis.ticks.length = unit(0, "pt")
    )
Code
Mean_times_cuisines_K <- Mean_times_cuisines |> 
  filter(str_detect(country, "^Sout|^Sp|^Swe"))
Code
Pies_K <- Mean_times_cuisines_K |> 
  ggplot(aes(x = "", y = percent, group = work_type, colour = work_type, fill = work_type)) + 
  geom_bar(width = 1, stat = "identity") +
  coord_polar("y", start=0) + 
  facet_grid(.~country) +
  theme_void() + 
  scale_color_viridis_d(labels = c("mean_cook_time" = "Cooking", "mean_other_time" = "Other", "mean_prep_time" = "Prep")) + 
  scale_fill_viridis_d(labels = c("mean_cook_time" = "Cooking", "mean_other_time" = "Other", "mean_prep_time" = "Prep")) + 
  labs(fill = "Type of work", colour = "Type of work") + 
  theme(
    axis.line = element_blank(),
      axis.title = element_blank(),
      axis.text = element_blank(),
      axis.ticks = element_blank(),
      axis.ticks.length = unit(0, "pt")
    )
Code
Mean_times_cuisines_L <- Mean_times_cuisines |> 
  filter(str_detect(country, "^Swi|^T"))
Code
Pies_L <- Mean_times_cuisines_L |> 
  ggplot(aes(x = "", y = percent, group = work_type, colour = work_type, fill = work_type)) + 
  geom_bar(width = 1, stat = "identity") +
  coord_polar("y", start=0) + 
  facet_grid(.~country) +
  theme_void() + 
  scale_color_viridis_d(labels = c("mean_cook_time" = "Cooking", "mean_other_time" = "Other", "mean_prep_time" = "Prep")) + 
  scale_fill_viridis_d(labels = c("mean_cook_time" = "Cooking", "mean_other_time" = "Other", "mean_prep_time" = "Prep")) + 
  labs(fill = "Type of work", colour = "Type of work") + 
  theme(
    axis.line = element_blank(),
      axis.title = element_blank(),
      axis.text = element_blank(),
      axis.ticks = element_blank(),
      axis.ticks.length = unit(0, "pt")
    )
Code
Mean_times_cuisines_M <- Mean_times_cuisines |> 
  filter(str_detect(country, "^V"))
Code
Pies_M <- Mean_times_cuisines_M |> 
  ggplot(aes(x = "", y = percent, group = work_type, colour = work_type, fill = work_type)) + 
  geom_bar(width = 1, stat = "identity") +
  coord_polar("y", start=0) + 
  facet_grid(.~country) +
  theme_void() + 
  scale_color_viridis_d(labels = c("mean_cook_time" = "Cooking", "mean_other_time" = "Other", "mean_prep_time" = "Prep")) + 
  scale_fill_viridis_d(labels = c("mean_cook_time" = "Cooking", "mean_other_time" = "Other", "mean_prep_time" = "Prep")) + 
  labs(fill = "Type of work", colour = "Type of work") + 
  theme(
    axis.line = element_blank(),
      axis.title = element_blank(),
      axis.text = element_blank(),
      axis.ticks = element_blank(),
      axis.ticks.length = unit(0, "pt")
    )

#Combining the plots

Code
(Pies_A / Pies_B / Pies_C / Pies_D / Pies_E / Pies_F / Pies_G / Pies_H / Pies_I / Pies_J / Pies_K / Pies_L / Pies_M) + plot_layout(guides = "collect",heights = c()) & theme(legend.position = "bottom", plot.margin = unit(c(0, 0, 0, 0), "cm"))

Unfortunately I couldn’t figure out how to make the spacing between each set of 4 smaller however this graph shows the rough amount of time each type of work takes per cuisine. There are some interesting trends, Amish and Mennonite have the most amount of time dedicated to other tasks, most likely because they do not use modern technology and have to rely on older method to store food, so fermentation and other longer term methods are impolyed more to preserve food. Southern recipes, Tex-Mex, Soul food spend about half of cooking time actually cooking the food on average. In america at least there could be some overlap in these cuisine categories. However Swiss cuisine also spends a lot of time cooking the food as well, and there is less overlap there. Chilean and Cajun and Creole spend the most time cooking out of all the cuisines, while Norwegians spend the most time preping the food. It would be interesting in the future to dig deep and pull out what are the most common ingredients in each cuisine and see if that relates at all to the different work categories.