soccerStandardiseCols: Rename columns in a dataframe for easier use with other...

Description Usage Arguments Value Examples

View source: R/soccerStandardiseCols.R

Description

Rename columns (e.g. "location.x" -> "x", "team.name" -> "team", etc...) to interface directly with other soccermatics functions without having to explicitly define column names as arguments. Currently only supports Statsbomb data.

Usage

1
soccerStandardiseCols(df, method = c("statsbomb"))

Arguments

df

a dataframe of Statsbomb event data

method

source of data; only "statsbomb" currently supported

Value

a dataframe with column names x, y, distance, angle, player_id, player_name, team_name, event_name

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
library(dplyr)
data(statsbomb)

# transform x,y-coords, standardise column names
my_df <- statsbomb %>% 
  soccerTransform(method = 'statsbomb') %>% 
  soccerStandardiseCols(method = 'statsbomb')
  
# feed to other functions without defining variables,
# x, y, id,distance, angle, etc...
soccerHeatmap(my_df)

JoGall/soccermatics documentation built on Aug. 12, 2021, 1:20 p.m.