Learn R Programming

soccermatics (version 0.9.5)

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

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

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

Run this code
# NOT RUN {
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)

# }

Run the code above in your browser using DataLab