Skip to content

Instantly share code, notes, and snippets.

@tonyelhabr
Last active September 8, 2021 03:07
Show Gist options
  • Save tonyelhabr/120b573bf2f57951c603fca99889ae70 to your computer and use it in GitHub Desktop.
Save tonyelhabr/120b573bf2f57951c603fca99889ae70 to your computer and use it in GitHub Desktop.
2021 ffsimulator predictions
library(ffscrapr)
library(ffsimulator)
library(ggplot2)
library(tonythemes)
conn <- espn_connect(
season = 2021,
league_id = 899513,
espn_s2 = Sys.getenv('FF_ESPN_S2'),
swid = Sys.getenv('FF_SWID')
)
conn
sim <- ff_simulate(conn = conn, n_seasons = 100, n_weeks = 14, seed = 42)
sim
autoplot(sim, type = 'wins') + theme_tony() + theme(legend.position = 'none') + labs(caption = NULL)
ggsave(filename = 'c:/users/aelhabr/desktop/ff_wins.png', width = 8, height = 8, type = 'cairo', dpi = 300)
autoplot(sim, type = 'rank') + theme_tony() + theme(legend.position = 'top', axis.text.x = element_blank(), panel.grid.major.x = element_blank()) + labs(caption = NULL) + guides(fill = guide_legend(''), color = 'none')
ggsave(filename = 'c:/users/aelhabr/desktop/ff_ranks.png', width = 12, height = 8, type = 'cairo', dpi = 300)
@tonyelhabr
Copy link
Author

ff_wins

@tonyelhabr
Copy link
Author

ff_ranks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment