You can install the released version of
fflr from GitHub with:
# install.packages("remotes") remotes::install_github("kiernann/fflr")
Here we see how we can chain together
functions to plot the weekly scores of each team in a stacked bar chart.
library(tidyverse) library(fflr) gaa <- extract_lid("https://fantasy.espn.com/football/league?leagueId=252353") teams <- form_teams(data = fantasy_members(lid = gaa)) scores <- fantasy_matchup(lid = gaa) %>% pluck("schedule") %>% map_df(form_matchup) %>% right_join(teams) %>% filter(score != 0) scores %>% ggplot(aes(x = reorder(abbrev, score), y = score)) + geom_col(aes(fill = week), position = position_stack(reverse = TRUE)) + labs(title = "Fantasy Football Scores", x = "Team", y = "Score") + guides(fill = guide_legend(nrow = 1)) + theme(legend.position = "bottom") + scale_fill_fantasy() + coord_flip()
Code of Conduct
Please note that the fflr project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.