-
Notifications
You must be signed in to change notification settings - Fork 20
/
make-from-scratch.R
63 lines (38 loc) · 1.92 KB
/
make-from-scratch.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
install.from.github <- function () {
install.packages("devtools")
library(devtools)
install_github ("war-on-ice/nhlscrapr")
install_github ("war-on-ice/warbase")
}
library(nhlscrapr)
library(warbase)
## If necessary, download everything; then let nhlscrapr do its thing. This concludes the refinement of the nhlscrapr stuff.
## This will take overnight if it hasn't been done yet.
games.grabbed <- compile.all.games(wait=0,
roster.dropin=rosterprefab,
## Want to use the existing games table? Uncomment this one.
new.game.table=filter (gamesstart, season >= 20072008),
## new.game.table=filter (gamesstart, season >= 20132014),
reload.games=TRUE)
make.common()
load("common-data/woi-common.RData")
#load ("source-data/nhlscrapr-core.RData")
#seasons <- unique(games$season)
#GamesGrabbedFull <- slice(gamestest, match(games.grabbed, paste0(gamestest$season, gamestest$gcode))) %>%
# select (season, gcode, date)
##date.set <- unique(games$date[match(games.grabbed, paste0(games$season, games$gcode))])
for (season in seasons[seasons <= 20132014]) prep.season (substr(season,1,4))
for (season in seasons[seasons >= 20142015]) prep.season.sportsnet (substr(season,1,4))
## Bind Sportsnet first.
for (ss in seasons[seasons <= 20132014]) try (merge.locs(ss))
for (ss in seasons[seasons >= 20142015]) try (merge.locs.sportsnet(ss))
for (ss in seasons) impute.shot.locs(ss)
## Make the distance adjustments for each season given the coordinates we just established.
create.adjusted.distance()
for (ss in seasons) try(update.adjusted.distance(ss))
##make.hextally (seasons, connect.sqldb2())
## At this point, everything's in place to make the individual game files.
make.game.files()
make.collective.coplay.files ()
replace.tc.all ()
## And we're done!