# NOT RUN {
library(dplyr)
# flip x,y-coords of France in both halves of statsbomb data
data(statsbomb)
statsbomb %>%
soccerFlipDirection(team = "team.name", x = "location.x", y = "location.y",
teamToFlip = "France")
# flip x,y-coords in 2nd half of Tromso, based on a dummy period variable
data(tromso)
tromso %>%
mutate(period = if_else(t > as.POSIXct("2013-11-07 21:14:00 GMT"), 1, 2)) %>%
soccerFlipDirection(periodToFlip = 2)
# }
Run the code above in your browser using DataLab