Home

Awesome

Passing networks using R

Here you can find a couple of R functions to create customized passing networks with both event data by Statsbomb and tracking data by Metrica Sport.

First, i would suggest to read this article in order to get some general context and more details of this work.

Then, you can follow this steps:

1.- Download the files contained in (or pull) this repository, including the codes (*.R files) and the field background images (*.JPG files from "fields" folder).

2.- Get the data

Statsbomb event data

Metrica Sport data

3.- Create your passing networks graphs

soccerPassNetEventing(gameID = 7584, TeamName = "Japan", poss = T, pass_dir = T, convex = T,
                      minPass = 5, node_pos = "origin", nodeFill = "blue", edgeAlpha = 0.5,
                      label = T, shortNames = T,  maxNodeSize = 15, maxEdgeSize = 2.5,  
                      Flipx = F, field = 1)

soccerPassNetTracking(gameID = "1", TeamName = "Home", pos_source = "track", node_pos = "origin",
                      context = "attacking", half = "own", field = 2,
                      pass_dir = T, minPass = 2, convex = T, 
                      label = T, shortNames = F, labelSize = 2, 
                      maxNodeSize = 12, maxEdgeSize = 1.5, edgeAlpha = 0.8)


This work is in some way a mix of these things:

Future/pending work: