---
title: "How to use `rvolleydata`"
author: "Matthew Chow"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{rvolleydata-how-to-use}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

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

## Overview

This vignette will outline how to use the functions in the `rvolleydata` package to access data from [League One Volleyball Pro (LOVB)](https://www.lovb.com/pro-league), [Athletes Unlimited Pro Volleyball (AU)](https://auprosports.com/volleyball/), and [Major League Volleyball (MLV)](https://provolleyball.com) leagues.

```{r setup}
library(rvolleydata)
library(dplyr)
```

## Installation

You can install the development version of [**`rvolleydata`**](https://github.com/awosoga/rvolleydata) from [GitHub](https://github.com/awosoga/rvolleydata) with:

```{r installation, eval=FALSE}
# install.packages("devtools")
devtools::install_github("awosoga/rvolleydata")
```

## Usage

The following code snippets will provide information on how to access different volleyball league statistics.
Each function has an identical signature where the user specifies their league of interest and the season(s).

### Schedules

Use `load_schedule` to access league schedules.

```{r schedule}
schedule <- load_schedule("au", 2025)
glimpse(schedule)
```
<!-- ### Leaderboards -->

<!-- Use `load_aupvb_leaderboards` to access Athletes Unlimited Pro Volleyball (AUPVB) leaderboards. -->

<!-- ```{r leaderboards} -->
<!-- load_aupvb_leaderboards <- load_aupvb_leaderboards(2024) -->
<!-- glimpse(load_aupvb_leaderboards) -->
<!-- ``` -->

### Play-by-Play

Use `load_pbp` to access play-by-play data.

```{r pbp}
pbp <- load_pbp("lovb", 2025)
glimpse(pbp)
```

### Officials

Use `load_officials` to access officials data.

```{r officials}
officials <- load_officials("mlv", 2025)
glimpse(officials)
```

### Player Information

Use `load_player_info` to access player information.

```{r boxscores}
player_info <- load_player_info("au", 2025)
glimpse(player_info)
```

### Team Staff

Use `load_team_staff` to access team staff data.

```{r team_staff}
team_staff <- load_team_staff("lovb", 2025)
glimpse(team_staff)
```

### Events Log

Use `load_events_log` to access events log data.

```{r events_log}
events_log <- load_events_log("mlv", 2025)
glimpse(events_log)
```

### Player Boxscores

Use `load_player_boxscore` to access player boxscore data.

```{r player_boxscores}
player_boxscores <- load_player_boxscore("au", 2025)
glimpse(player_boxscores)
```

### Team Boxscores

Use `load_team_boxscore` to access team boxscore data.

```{r team_boxscores}
team_boxscores <- load_team_boxscore("mlv", 2025)
glimpse(team_boxscores)
```
