---
title: "analyse"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{analyse}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
	echo = FALSE
)
```

```{r setup}
library(dtlscores)
library(dplyr, warn.conflicts = FALSE)
```

Für uns sind die Teams der zweiten Bundesliga Süd in 2026 von Interesse:

```{r team_overview}
teams <- c("Exquisa Oberbayern", "TSV Monheim", "TT Buttenwiesen-Inningen", "VfL Kirchheim unter Teck", "TSV Unterföhring", "TSV Pfuhl", "TG Hanauerland", "KTV Ries") #nolint

routines |>
  filter(team %in% teams, end_value > 0) |>
	group_by(competition_url) |>
	filter(n() == 24) |>
	ungroup() |>
	select(team, competition_url, end_value) |>
  unique() |>
	left_join(competitions, by = join_by(competition_url)) |>
	filter(season == "2025") |>
	group_by(team) |>
	summarize(league = unique(league),
				 total = mean(end_value) * 24) |>
	arrange(desc(total)) |>
	rename(Team = "team", 
				 `Liga 2025` = "league",
				 `Durschn. Endwert` = "total") |>
	gt::gt()
```
