dfs-with-r / coach

Lineup optimization for daily fantasy sports
https://dfs-with-r.github.io/coach/
GNU General Public License v3.0
46 stars 14 forks source link

fpts_proj #27

Closed jtpolish closed 3 years ago

jtpolish commented 3 years ago

Hi, I was wondering if you might be able to help me manually load fpts_proj projections rather than use: set.seed(100) n <- nrow(data) data$fpts_proj <- rnorm(n, data$fpts_avg) View(data)

I have a subscription to fantasydata.com and would like to input their projections manually.

Thank you for your help!

zamorarr commented 3 years ago

Hi @jtpolish . Yes you can definitely do that! You'll have to read in the fantasy data into a data frame first and then just assign the fpts_proj column to that data. It would look something like this:

library(coach)
library(readr)

# read in the fantasydata
myprojs <- read_csv("path/to/fantasydata.csv")

# all your other normal coach stuff
...

# add your custom projections to the data (assuming the fantasy data col with projections is called "fpts"
data$fpts_proj <- myprojs$fpts

# continue on with optimization
...

Does that help? If you attach the fantasydata here I can also take a look and give you more detailed code instructions. Let me know.

jtpolish commented 3 years ago

Hi @jtpolish . Yes you can definitely do that! You'll have to read in the fantasy data into a data frame first and then just assign the fpts_proj column to that data. It would look something like this:

library(coach)
library(readr)

# read in the fantasydata
myprojs <- read_csv("path/to/fantasydata.csv")

# all your other normal coach stuff
...

# add your custom projections to the data (assuming the fantasy data col with projections is called "fpts"
data$fpts_proj <- myprojs$fpts

# continue on with optimization
...

Does that help? If you attach the fantasydata here I can also take a look and give you more detailed code instructions. Let me know.

Zamorarr,

You are a lifesaver! It worked like a charm :) Thank you for your help