Giter Site home page Giter Site logo

gellert99 / passing-networks Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dato-futbol/passing-networks

0.0 0.0 0.0 4.22 MB

A couple of functions to create customized passing networks with event data by Statsbomb and tracking data by Metrica Sport

R 100.00%

passing-networks's Introduction

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

  • Don't forget to read and agree to the User Agreement

  • Get the data using the code of the file "get_SB_event_data_WC2018.R" (save the file "SB_WC_events_clean.RDS" into a folder named "data")

  • If you have any problem with this process you can also review these excellent resources about working with Statsbomb data in R: 1 & 2

Metrica Sport data

3.- Create your passing networks graphs

  • Open the "main_code.R" file, load the necessary packages and call the respective function to create your customized graphs.

  • There are a lot of arguments to configurate the creation and outputs of the passing networks, both data selection and aesthetics parts.

  • Here a code example using Statsbomb data with the function "soccerPassNetEventing.R"

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)

  • And here a code using Metrica Sport data with the function "soccerPassNetTracking.R"
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:

  • Mainly to enable a passes value metric option, like VAEP, xT, g+, EPV or similar

passing-networks's People

Contributors

bustami avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.