-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
80 lines (54 loc) · 4.13 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
---
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%"
)
```
# epts
<!-- badges: start -->
[![R-CMD-check](https://github.com/george-wood/epts/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/george-wood/epts/actions/workflows/R-CMD-check.yaml)
[![codecov](https://codecov.io/gh/george-wood/epts/branch/master/graph/badge.svg?token=ZM8CUR8P13)](https://codecov.io/gh/george-wood/epts)
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
<!-- badges: end -->
epts is a package for reading [Electronic Performance and Tracking Systems](https://www.fifa.com/technical/football-technology/standards/epts) (EPTS) data.
## Overview
EPTS is a broad term for camera-based and wearable technologies that measure and track players and the ball in football (soccer). This includes positioning systems that track player and ball positions, accelerometers, gyroscopes, and other technologies. The data produced by EPTS is widely used for analytics. However, as the number of vendors providing EPTS data has increased, so has the complexity of integrating this data into analytical pipelines, as noted by FIFA^[[FIFA Standard Data Transfer Format](https://digitalhub.fifa.com/m/477d8daa7f0ac4c9/original/standard-transfer-format-documentation.pdf)]:
> Alongside the increasing adoption of these devices, the variety of brands and vendors have also increased up to tens of providers in this timeframe. While more data is being generated, the operational maintenance and integration of this information becomes everyday more complex. A central issue is that each different vendor defines its own format and specification for the data that is being provided. While is typical to also provide software to interpret this data, the increasing availability of sources of information and the need of data centralization makes very difficult for clubs to keep the growing pace of this industry, regarding the needs for continuous integration and maintainability of data. Also, the ad-hoc nature of provided formats makes harder to integrate information from different sources, making progress in this area slower.
In response to this problem, FIFA and FC Barcelona have developed a standard format for exchanging EPTS data. The standard format requires that vendors produce two files when exchanging data:
- A raw data file, which contains the actual data in a format that can be parsed line by line
- An xml file, which contains a data format specification that defines the format of the raw data file alongside other metadata
The epts package makes it easy to read the raw data file according to the data format specification.
## Features
With epts, you can:
- Import the raw data file according to the data format specification
- Extract metadata, including specific fields such as the frame rate or team name
When importing raw data, epts always returns a `data.frame` with column names as defined in the data format specification. For flexibility, the metadata is extracted as a `list`.
## Installation
You can install the development version of epts from [GitHub](https://github.com/) using:
``` r
# install.packages("devtools")
devtools::install_github("george-wood/epts")
```
## Usage
```{r library}
library(epts)
```
The package includes [example data](https://www.fifa.com/technical/football-technology/standards/epts/research-development-epts-standard-data-format) provided by FIFA:
```{r example}
# txt file including player and ball tracking data
raw_data <- epts_example("fifa_example.txt")
readLines(raw_data, warn = FALSE)
# xml file including metadata and format specification
metadata <- epts_example("fifa_example.xml")
```
Import the raw data according to the format specification:
```{r read}
read_epts(raw_data, metadata)
```
The example data provided by FIFA is misspecified: the raw data includes frames that are not defined in the data format specification. The user is warned about this.