Intro Thoughts

Status Quo

library(tidyverse)

harvest_2021 <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2024/2024-05-28/harvest_2021.csv')
spending_2021 <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2024/2024-05-28/spending_2021.csv')


spending_2021 %>% 
  ggplot() + 
  labs(title = "Lisa's Garden Spending, 2021") +
  aes(area = price, id = "All") + 
  ggcirclepack::geom_circlepack(show.legend = F, 
                                color = "black", 
                                linewidth = .15) + 
  coord_equal() + 
  ggcirclepack::geom_circlepack_text(show.legend = F) +
  ggstamp::theme_void_fill()  + 
  aes(label = after_stat(paste0(id, "\n$", area))) + 
  aes(fill = I("aliceblue"))

last_plot() +
  aes(id = vegetable) + 
  labs(title = "Spending breakdown") + 
  aes(label = after_stat(paste0(id, "\n$", area)))

last_plot() %+% 
  harvest_2021 + aes(area = weight) + 
  labs(title = "Lisa's Garden 2021, Harvest") + 
  aes(label = after_stat(paste0(id, "\n", round(area/1000), "kg"))) +
  aes(fill = I("lightsalmon3")) + 
  aes(color = I("grey90"))

last_plot() +
  aes(id = "All") + 
  labs(title = "Harvest, Aggregate") 

harvest_2021 %>% 
  count(wt = weight)
## # A tibble: 1 × 1
##        n
##    <dbl>
## 1 451406

harvest_2021 <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2024/2024-05-28/harvest_2021.csv')
## Rows: 726 Columns: 5
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (3): vegetable, variety, units
## dbl  (1): weight
## date (1): date
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
library(tidyverse)
library(ggcirclepack)

harvest_2021 %>%
  filter(vegetable != "sweet potato") %>% # didn't seem believable..
  ggplot() + 
  aes(area = weight/1000, id = vegetable) + 
  geom_circlepack(fun = mean) + 
  geom_circlepack_text(fun = mean) + 
  aes(label = after_stat(paste0(id, "\n", 
                                round(area,1), "kg"))) + 
  labs(title = "Average amount harvested") +
  aes(fill = after_stat(area)) +
  scale_fill_viridis_c(option = "inferno") + 
  coord_equal()
## Warning: Unknown or uninitialised column: `wt`.
## Unknown or uninitialised column: `wt`.

harvest_2021 %>% 
  group_by(vegetable) %>% 
  summarise(weight = mean(weight)/1000) %>% 
  arrange(-weight)
## # A tibble: 33 × 2
##    vegetable    weight
##    <chr>         <dbl>
##  1 sweet potato  5.87 
##  2 pumpkin       2.87 
##  3 watermelon    2.18 
##  4 potatoes      1.61 
##  5 rutabaga      1.32 
##  6 squash        1.29 
##  7 carrots       1.20 
##  8 zucchini      1.08 
##  9 tomatillos    0.795
## 10 cucumbers     0.769
## # ℹ 23 more rows

Closing remarks, Other Relevant Work, Caveats