# Using R
# Option 1: tidytuesdayR R package 

all_recipes <- readr::read_csv(
  "https://raw.githubusercontent.com/owlzyseyes/tastyR/refs/heads/main/data-raw/allrecipes.csv"
)

cuisines <- readr::read_csv(
  "https://raw.githubusercontent.com/owlzyseyes/tastyR/refs/heads/main/data-raw/cuisines.csv"
)


viz1_df <- all_recipes %>%
  mutate(actionable = total_time <= 45 & avg_rating >= 4.5)


all_recipes <- readr::read_csv("https://raw.githubusercontent.com/owlzyseyes/tastyR/refs/heads/main/data-raw/allrecipes.csv")
cuisines <- readr::read_csv("https://raw.githubusercontent.com/owlzyseyes/tastyR/refs/heads/main/data-raw/cuisines.csv")

all_recipes
## # A tibble: 14,426 × 16
##    name     url   author date_published ingredients calories   fat carbs protein
##    <chr>    <chr> <chr>  <date>         <chr>          <dbl> <dbl> <dbl>   <dbl>
##  1 Chewy W… http… DMOMMY 2020-06-18     ⅓ cup marg…      222    13    24       6
##  2 Pumpkin… http… Bobbi… 2022-09-26     12  egg yo…      477    31    43       8
##  3 Eggs Po… http… Bren   2018-06-08     2 tablespo…      354    18    32      20
##  4 Minestr… http… Sarah… 2025-03-03     4 cups dri…      356     9    53      19
##  5 Yummy S… http… Procr… 2024-12-11     4 green be…      366    22    23      19
##  6 Prime R… http… Cajun… 2019-04-03     1 (8 pound…      709    47    31      37
##  7 Parmesa… http… Anika  2023-01-04     1 large eg…      466    27     1      52
##  8 Chicken… http… Bob C… 2022-07-14     12 cups wa…      782    61    19      40
##  9 Sweet P… http… Dean   2023-01-19     3 pounds p…      355    15    33      23
## 10 Quick B… http… Chris… 2024-11-14     canola oil…      395    12    33      37
## # ℹ 14,416 more rows
## # ℹ 7 more variables: avg_rating <dbl>, total_ratings <dbl>, reviews <dbl>,
## #   prep_time <dbl>, cook_time <dbl>, total_time <dbl>, servings <dbl>
cuisines
## # A tibble: 2,218 × 17
##    name     country url   author date_published ingredients calories   fat carbs
##    <chr>    <chr>   <chr> <chr>  <date>         <chr>          <dbl> <dbl> <dbl>
##  1 Saganak… Greek   http… John … 2024-02-07     1 (4 ounce…      391    25    15
##  2 Coney I… Jewish  http… John … 2024-11-26     2 ¾ cups a…      301    17    31
##  3 Diana's… Austra… http… CHIPP… 2022-07-14     1 ½ cups w…       64     3     9
##  4 Chilean… Chilean http… Heidi  2025-01-31     ½ cup chop…      106     9     7
##  5 Tex-Mex… Tex-Mex http… Ann    2025-02-18     2 cups all…      449    23    58
##  6 Newfoun… Canadi… http… MomWh… 2022-08-12     1 (3 pound…      958    24   144
##  7 Pasta e… Italian http… Buckw… 2023-12-12     1 cup dry …      378    10    59
##  8 Danish … Danish  http… TheOt… 2020-06-19     4 cups all…       90     5    10
##  9 Lemon P… Amish … http… Laura… 2025-01-21     2 cups all…      157     6    25
## 10 Pan con… Spanish http… Luis … 2025-06-02     1 large to…      322    16    39
## # ℹ 2,208 more rows
## # ℹ 8 more variables: protein <dbl>, avg_rating <dbl>, total_ratings <dbl>,
## #   reviews <dbl>, prep_time <dbl>, cook_time <dbl>, total_time <dbl>,
## #   servings <dbl>

The Tidy Tuesday dataset for the week of September 16, 2025 contains recipe information scraped from Allrecipes.com. The dataset includes two tables: all_recipes, which provides detailed information on more than 5,000 individual dishes, and cuisines, which links each recipe to a country or cultural cuisine type.

viz1 <- ggplot(viz1_df, aes(x = total_time, y = avg_rating)) +
  
  geom_point(alpha = 0.15, size = 1) +
  

  geom_point(
    data = viz1_df %>% filter(actionable),
    aes(x = total_time, y = avg_rating),
    color = "gold",
    alpha = 0.7,
    size = 1.5
  ) +
  

  geom_smooth(
    method = "loess",
    se = FALSE,
    linewidth = 1.1,
    color = "blue"
  ) +
  

  scale_x_continuous(
    breaks = c(15, 30, 45, 60, 90, 120, 180, 240)
  ) +
  
  scale_y_continuous(
    limits = c(0, 5),
    breaks = 0:5
  ) +
  
  labs(
    title = "Are efficient recipes also highly rated?",
    subtitle = "Highly rated Allrecipes dishes tend to cluster in the under 1 hour range.\ngold points highlight 'efficient' recipes (< 45 min, rating > 4.5).",
    x = "Total time in minutes",
    y = "Average rating from 0–5 stars",
    caption = "Data: TidyTuesday 2025-09-16 • Allrecipes.com"
  ) +
  
  theme_minimal(base_size = 12) +
  theme(
    plot.title = element_text(face = "bold"),
    plot.subtitle = element_text(size = 10),
    panel.grid.minor = element_blank()
  )

viz1

Why These Visualizations Are Effective Visualization 1: Do We Really Love Time-Intensive Recipes?

This scatter plot explores the relationship between total cooking time and average user ratings across more than 5,000 Allrecipes dishes. By displaying every recipe as part of a semi-transparent point cloud, the visualization makes it easy to see overall density patterns—specifically, that the vast majority of highly rated dishes cluster under the one-hour mark. The addition of a LOESS smoothing line emphasizes the broader negative trend: as recipe time increases, ratings tend to decline.

I added a gold overlay for recipes that are both fast (< 45 minutes) and highly rated (> 4.5 stars), to add a more distinct insight. These points stand out immediately and help answer the key question: Are efficient recipes also highly rated? The contrast created by the gold layer against the blue smoothing line brings attention to this subset without overwhelming the overall distribution. The axis choices, minimal grid, and clear caption make the plot clean, readable, and purposeful. Overall, this visualization is effective because it reveals both the general trend and a meaningful subgroup in a way that is intuitive and visually compelling.

library(tidyverse)
library(maps)
library(countrycode)


cuisine_world <- cuisines %>%
  filter(!is.na(country)) %>%
  group_by(country) %>%
  summarise(
    n_recipes = n(),
    total_reviews = sum(reviews, na.rm = TRUE),
    mean_rating = mean(avg_rating, na.rm = TRUE),
    .groups = "drop"
  ) %>%
  filter(n_recipes >= 5)

cuisine_world$map_country <- countrycode(cuisine_world$country,
                                         origin = "country.name",
                                         destination = "country.name")


world_map <- map_data("world")


country_centroids <- world_map %>%
  group_by(region) %>%
  summarise(
    long = mean(range(long)),
    lat = mean(range(lat))
  )

cuisine_map <- cuisine_world %>%
  inner_join(country_centroids, by = c("map_country" = "region"))


viz_map <- ggplot() +
  geom_map(
    data = world_map,
    map = world_map,
    aes(x = long, y = lat, map_id = region),
    fill = "white",
    color = "gray",
    size = 0.2
  ) +
  
  geom_point(
    data = cuisine_map,
    aes(x = long, y = lat,
        size = total_reviews,
        color = mean_rating),
    alpha = 0.8
  ) +
  
  scale_color_gradient(
    low = "lightblue",  
    high = "darkblue"   
  ) +
  
  scale_size(range = c(2, 12), guide = "none") +
  
  coord_fixed(1.3) +
  
  labs(
    title = "Global Popularity of Recipe Cuisines",
    subtitle = "Bubble size = total reviews   Bubble color = avg rating",
    color = "Avg Rating",
    caption = "Data: TidyTuesday 2025-09-16 • Allrecipes.com"
  ) +
  
  theme_minimal(base_size = 12) +
  theme(
    panel.grid = element_blank(),
    plot.title = element_text(face = "bold", size = 18),
    plot.subtitle = element_text(size = 10)
  )

viz_map

Visualization 2: Global Popularity of Recipe Cuisines

This world map visualization highlights the geographic distribution of cuisines represented on Allrecipes, summarizing popularity using two intuitive visual encodings: bubble size (total number of reviews received) and bubble color (average rating). Countries with at least five dishes appear on the map, ensuring that each point represents a meaningful presence rather than noise. Placing cuisine summaries at approximate country centroids works well because it avoids clutter while still preserving geographic context. The soft gray basemap allows the review and rating information to stand out clearly, and the blue gradient color scale provides an immediate sense of which cuisines, on average, are rated more favorably. This visualization effectively conveys global differences in user engagement with cuisine types while maintaining simplicity and interpretability.