# Win Your Fantasy Football Snake Draft with this Shiny App in R

[This article was first published on

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

In a previous post, I showed how to determine the best starting lineup to draft in an auction draft using an optimizer tool. In this post, I use a Shiny app in R to determine the best possible players to pick in a fantasy football snake draft. The app takes projections from FantasyPros, a site that averages across numerous sources of projections. Based on your league settings, it determines which players you should draft to maximize your players’ value over typical replacement players at their respective positions. It also allows you to change your risk tolerance to avoid picking risky players. Best of all, the app updates the selections automatically with your inputs, and you can download the data for yourself. So let’s get to it. Here’s a more thorough description:**Fantasy Football Analytics in R**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

### How it Works

First, I use a script to scrape player’s projected points from FantasyPros using the XML package in R. FantasyPros is an ideal source of projections because it averages across numerous sources of projections, and is the most accurate source of projections I’ve been able to find. Second, I calculate players’ risk levels, as defined by the standard deviation (uncertainty) around the players’ ranks and projections across sources. Note that risk is standardized to have a mean of 5 and a standard deviation of 2. Third, I take user inputs on league settings to calculate projections that are custom tailored for your league (e.g., based on how many points a passing TD is worth in your league). Fourth, I calculate the value of each player over a typical replacement player at his position. The output displayed to the user includes the top two players at each position, with the 8 players sorted by value over replacement.Note on risk: although bench players are important in the case of a starter’s injury or under-performance, it is generally best to draft starters with minimal risk to ensure solid, if not superior, performance. On the other hand, one should accept more risk with bench players because such a move has a low risk, high reward potential. It may also be worth noting that for bench players, value over replacement may be less important than a player’s upside.

### User Inputs

Typical Replacement for QBs: the position rank set to be the “typical replacement player” for a QB (default is 15 from FootballGuys).Typical Replacement for RBs” the position rank set to be the “typical replacement player” for a RB (default is 36 from FootballGuys).

Typical Replacement for WRs: the position rank set to be the “typical replacement player” for a WR (default is 38 from FootballGuys).

Typical Replacement for TEs: the position rank set to be the “typical replacement player” for a TE (default is 8 from FootballGuys).

__Scoring Settings__

Passing Yards Per Point: How many passing yards are worth 1 fantasy point?

Points Per Passing TD: How many points is each passing touchdown worth?

Points Per Passing INT: How many points is each interception worth?

Rushing Yards Per Point: How many rushing yards are worth 1 fantasy point?

Points Per Rushing TD: How many points is each rushing touchdown worth?

Points Per Reception: How many points are receptions worth?

Receiving Yards Per Point: How many receiving yards are worth 1 fantasy point?

Points Per Receiving TD: How many points is each receiving touchdown worth?

Points Per Fumble: How many points is each fumble worth?

Players Drafted: Select all players drafted by you or others (hold CTRL to select multiple).

Maximum Risk Tolerance: Selects the maximum risk allowed for any player to be considered for inclusion in the optimal starting lineup. Players’ risk levels have a mean of 5 and a standard deviation of 2.

### The Shiny App

Below is the Shiny App for optimizing your draft by picking the players that maximize your starting lineup’s projected points. For the original Shiny App, go to:

To

**leave a comment**for the author, please follow the link and comment on their blog:**Fantasy Football Analytics in R**.R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.