R Code [show / hide]
gummi_tbl <- read_excel("data/gummibears.xlsx")Last modified on 04. March 2026 at 19:20:27
“Gummi Bears! Bouncing here and there and everywhere; High adventure that’s beyond compare; They are the Gummi Bears.” — Gummi Bears Theme, Adventures of the Gummi Bears
gummi_tbl <- read_excel("data/gummibears.xlsx")| year | darkred | lightred | orange | yellow | green | white |
|---|---|---|---|---|---|---|
| 2018 | 0 | 0 | 5 | 4 | 0 | 0 |
| 2018 | 0 | 3 | 1 | 4 | 1 | 1 |
| 2018 | 1 | 2 | 2 | 2 | 1 | 1 |
| 2018 | 2 | 0 | 2 | 1 | 2 | 3 |
| … | … | … | … | … | … | … |
| 2025 | 0 | 0 | 0 | 3 | 2 | 4 |
| 2025 | 3 | 0 | 0 | 2 | 0 | 3 |
| 2025 | 2 | 1 | 2 | 3 | 1 | 1 |
| 2025 | 1 | 0 | 2 | 2 | 2 | 2 |
gummi_count_tbl <- gummi_bears_tbl %>%
rowwise() %>%
mutate(count_bear = sum(c_across(darkred:white)),
count_color = sum(c_across(darkred:white) > 0)) |>
ungroup() |>
select(year, count_bear, count_color)| year | count_bear | count_color |
|---|---|---|
| 2018 | 9 | 2 |
| 2018 | 10 | 5 |
| 2018 | 9 | 6 |
| 2018 | 10 | 5 |
| … | … | … |
| 2025 | 9 | 3 |
| 2025 | 8 | 3 |
| 2025 | 10 | 6 |
| 2025 | 9 | 5 |
| year | most_liked | gender | age | height | semester |
|---|---|---|---|---|---|
| 2018 | lightred | male | 35 | 193 | 10 |
| 2018 | yellow | female | 21 | 159 | 6 |
| 2018 | white | female | 21 | 159 | 6 |
| 2018 | white | female | 36 | 180 | 10 |
| … | … | … | … | … | … |
| 2025 | white | female | 28 | NA | NA |
| 2025 | yellow | female | 21 | 178 | 1 |
| 2025 | orange | male | 22 | 176 | 1 |
| 2025 | darkred | female | 24 | 170 | 1 |
Further tutorials and R packages on XXX
what does it mean.