This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# dataframe 'dat' w/ x,y-coords in columns 'x' and 'y' and timestamp in column, 'ts', e.g.: | |
library(soccermatics) | |
attach(tromso) | |
dat <- subset(tromso, id == 8)[,c(1,3:4)] | |
#calculate direction of each vector angle (in radians) | |
v <- diff(complex(real = dat$x, imaginary = dat$y)) | |
dat$direction <- c(NA, diff(Arg(v)) %% (2*pi), NA) - pi | |
# calculate speed (distance / time interval) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(dplyr) | |
require(ggplot2) | |
# get week-by-week data for current season and last (data originally taken from official API) | |
d17 <- read.csv(url("https://github.com/JoGall/FantasyPL/blob/master/17-18.csv")) | |
d16 <- read.csv(url("https://github.com/JoGall/FantasyPL/blob/master/16-17_formatted.csv")) | |
# compute price changes | |
ss16 <- d16 %>% | |
group_by(player_id) %>% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Data on set piece goals scored and conceded in 2016-17 from [here](https://objective-football.blogspot.co.uk/2016/08/201617-open-playset-piecepenalty-data.html). | |
--- | |
# Get data | |
```{r} | |
library(dplyr) | |
library(XML) | |
library(RCurl) | |
library(engsoccerdata) |
NewerOlder