forked from openvolley/fivbvis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
140 lines (104 loc) · 5.97 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# fivbvis
<!-- badges: start -->
[](https://www.tidyverse.org/lifecycle/#experimental)

<!-- badges: end -->
fivbvis provides an R client to the [FIVB VIS web service system](https://www.fivb.org/VisSDK/VisWebService/#Introduction.html).
## Installation
You can install the development version of fivbvis like so:
``` r
install.packages("remotes") ## if needed
remotes::install_github("wehsLai/fivbvis")
```
## Example
This is a basic example which shows you how to get data:
By default, results are cached in a per-session cache, so if we make the same request again the local results are used, rather than re-downloading.
### 1. Tournaments List with Filter
```{r example1}
library(fivbvis) # load package
pl <- list(Fields = "No ShortNameOrName Season DefaultPlayersRanking")
cl <- list(Filter = c(Seasons = "2021"))
vb_tournaments <- v_get_volley_tournament_list(parent = pl, children = cl)
vb_tournaments
```
### 2. Matches List with Filter
```{r example2}
s_tournament <- vb_tournaments[vb_tournaments$shortNameOrName == "FIVB VNL MEN", ]
pl <- list(Fields = "DateTimeLocal PoolName, TeamAName TeamBName MatchResultText")
cl <- list(Filter = c(NoTournament = s_tournament$no))
v_get_volley_match_list(parent = pl, children = cl)
```
### 3. Pools List with Filter
```{r example3}
pl <- list(Fields = "Name RoundName")
cl <- list(Filter = c(NoTournament = s_tournament$no, ForRanking = NULL))
v_get_volley_pool_list(parent=pl, children = cl)
```
### 4. Teams List with Filter
```{r example4}
pl <- list(Fields = "Code Name")
cl <- list(Filter = c(NoTournament = s_tournament$no))
v_get_volley_team_list(parent = pl, children = cl)
```
### 5. Players List with Filter
```{r example5}
pl <- list(Fields = "Team NoShirt FirstNamePlayer LastNamePlayer Position")
cl <- list(Filter = c(NoTournament = s_tournament$no))
v_get_volley_player_list(parent = pl, children = cl)
```
### 6. Statistics List with Filter, Relation
```{r example6}
pl <- list(Fields = "BlockPoint BlockFault BlockContinue BlockTotal",
SumBy = "Tournament")
cl <- list(Filter = c(NoTournaments = s_tournament$no, MatchesToUse="MatchesFinished"),
Relation = c(Name="Match", Fields="NoInTournament DateLocal TeamACode TeamBCode MatchResult"),
Relation = c(Name="Team", Fields="Code Name"),
Relation = c(Name="Player", Fields="TeamName FirstName LastName VolleyPosition"))
v_get_volley_statistic_list(parent = pl, children = cl)
```
### 7. Pool Ranking
```{r example7}
pl <- list(Fields = "No")
cl <- list(Filter = c(NoTournament = s_tournament$no, ForRanking=TRUE))
vb_pools_frk <- v_get_volley_pool_list(parent=pl, children = cl)
if(length(vb_pools_frk) > 0) {
pl <- list(NoPool = vb_pools_frk$no[1],
Fields = "RankTextWithRepeat TeamCode MatchPoints MatchesWon MatchesLost Matches")
v_get_volley_pool_ranking(parent = pl)
}
```
### 8. Tournament Ranking
```{r example8}
pl <- list(NoTournament = s_tournament$no,
Fields = "RankTextWithRepeat TeamName")
v_get_volley_tournament_ranking(parent = pl)
```
### 9. Player Spike Ranking
```{r example9}
if(!is.na(s_tournament$defaultPlayersRanking)) {
pl <- list(No = s_tournament$defaultPlayersRanking,
NumberOfScorers = 10, NumberOfPlayers = 10, Skills = "Spike")
vb_players_ranking <- v_get_volley_player_ranking(parent = pl)
vb_players_ranking$Spike[c("TeamCode", "FirstName", "LastName", "Successes", "Faults", "Continues", "TotalAttempts", "Note")]
}
```
## Troubleshooting
Known issues:
### `internal error: Huge input lookup`
This indicates that the XML response from the FIVB server is too large or deeply nested and is causing the parser to fail. By default the parser restricts the nesting level that it allows, in order to prevent crashes or other undesirable behaviour. But you can remove this restriction by:
```{r eval = FALSE}
v_options(huge_xml = TRUE)
```
and then try your request again.