Closed jacobakaye closed 3 weeks ago
Hey Jacob, you'll want to create your own scoring object, make sure receptions are 1pt, and then pass that to the projections table function. Like so:
# Create a scoring object using our default scoring object
scoring_obj = ffanalytics::scoring
# Look at receptions
scoring_obj$rec$rec
# Set receptions to be equal to 1 point
scoring_obj$rec$rec = 1
# Use scoring object
my_projections = projections_table(my_scrape, scoring_rules = scoring_obj)
Let us know if you have any other questions!
Hi. Thank you. Would I have to change all the scoring categories to PPR?
Also, are all the functions working? Could you possibly provide more sample code on the website to calculate projections?
Hey Jacob, you would have to update any part of the scoring object that is not in-line with your league settings. E.g., if your league gives 5 points for passing touchdowns you would want to make sure your scoring settings reflect that. I.e.:
scoring_obj$pass$pass_tds = 5
You then pass the scoring object to your projections table function.
As for your second question--"are all the functions working?" I'll need you to be a bit more specific. What are you confused about?
Ah, I just saw you asked about theadd_risk()
function as well. We no longer export it / it is superseded by theadd_uncertainty()
function.
How can I use these functions:
confidence_interval() set_tiers()
I'm just trying to learn how to use this package. Thanks!
I would like these settings for the scoring, but I'm not sure how to exactly make sure it's set within the code:
list(
pass = list(
pass_att = 0, pass_comp = 0, pass_inc = 0, pass_yds = 0.04, pass_tds = 4,
pass_int = -2, pass_40_yds = 0, pass_300_yds = 0, pass_350_yds = 0,
pass_400_yds = 0
),
rush = list(
all_pos = TRUE,
rush_yds = 0.1, rush_att = 0, rush_40_yds = 0, rush_tds = 6,
rush_100_yds = 0, rush_150_yds = 0, rush_200_yds = 0),
rec = list(
all_pos = TRUE,
rec = 1, rec_yds = 0.1, rec_tds = 6, rec_40_yds = 0, rec_100_yds = 0,
rec_150_yds = 0, rec_200_yds = 0
),
misc = list(
all_pos = TRUE,
fumbles_lost = -2, fumbles_total = 0,
sacks = 0, two_pts = 2
),
kick = list(
xp = 1.0, fg_0019 = 3.0, fg_2029 = 3.0, fg_3039 = 3.0, fg_4049 = 4.0,
fg_50 = 5.0, fg_miss = 0.0
),
ret = list(
all_pos = TRUE,
return_tds = 6, return_yds = 0
),
dst = list(
dst_fum_rec = 2, dst_int = 2, dst_safety = 2, dst_sacks = 1, dst_td = 6,
dst_blk = 1.5, dst_ret_yds = 0, dst_pts_allowed = 0
),
pts_bracket = list(
list(threshold = 0, points = 10),
list(threshold = 6, points = 7),
list(threshold = 20, points = 4),
list(threshold = 34, points = 0),
list(threshold = 99, points = -4)
)
)
Hey Jacob, you shouldn't use the confidence_interval()
or set_tiers()
functions / they are not exported. Also, you would assign that list to object (my_scoring = list(you_list_from_above)
) and pass it as the scoring object to the projections_table()
function. Let me know if sample code would be helpful but I am going to close this for now (feel free to reply still if you are still having issues)
Hi. Yes, please. Also, any other code to prepare for a 12-team PPR draft would be awesome if you can!
I think something is wrong here... could you possibly help me out?
library(ffanalytics)
library(tidyverse)
library(dplyr)
library(tidyr)
library(dplyr)
my_scrape <- scrape_data(src = c("CBS", "NFL", "ESPN", "NumberFire"),
pos = c("QB", "RB", "WR", "TE", "DST"),
season = NULL, # NULL grabs the current season
week = NULL) # NULL grabs the current week
my_projections <- projections_table(my_scrape)
my_projections <- my_projections %>%
add_ecr() %>%
add_adp() %>%
add_aav() %>%
add_uncertainty()
# Create a scoring object using our default scoring object
scoring_obj = list(
pass = list(
pass_att = 0, pass_comp = 0, pass_inc = 0, pass_yds = 0.04, pass_tds = 4,
pass_int = -2, pass_40_yds = 0, pass_300_yds = 0, pass_350_yds = 0,
pass_400_yds = 0
),
rush = list(
all_pos = TRUE,
rush_yds = 0.1, rush_att = 0, rush_40_yds = 0, rush_tds = 6,
rush_100_yds = 0, rush_150_yds = 0, rush_200_yds = 0),
rec = list(
all_pos = TRUE,
rec = 1, rec_yds = 0.1, rec_tds = 6, rec_40_yds = 0, rec_100_yds = 0,
rec_150_yds = 0, rec_200_yds = 0
),
misc = list(
all_pos = TRUE,
fumbles_lost = -2, fumbles_total = 0,
sacks = 0, two_pts = 2
),
kick = list(
xp = 1.0, fg_0019 = 3.0, fg_2029 = 3.0, fg_3039 = 3.0, fg_4049 = 4.0,
fg_50 = 5.0, fg_miss = 0.0
),
ret = list(
all_pos = TRUE,
return_tds = 6, return_yds = 0
),
dst = list(
dst_fum_rec = 2, dst_int = 2, dst_safety = 2, dst_sacks = 1, dst_td = 6,
dst_blk = 1.5, dst_ret_yds = 0, dst_pts_allowed = 0
),
pts_bracket = list(
list(threshold = 0, points = 10),
list(threshold = 6, points = 7),
list(threshold = 20, points = 4),
list(threshold = 34, points = 0),
list(threshold = 99, points = -4)
)
)
# Look at receptions
scoring_obj$rec$rec
# Set receptions to be equal to 1 point
scoring_obj$rec$rec = 1
# Use scoring object
my_projections = projections_table(my_scrape, scoring_rules = scoring_obj)
my_projections
my_projections <- my_projections %>%
add_player_info()
view(my_projections)
# Filter for each position separately
qb_projections <- my_projections %>%
filter(pos == "QB")
rb_projections <- my_projections %>%
filter(pos == "RB")
wr_projections <- my_projections %>%
filter(pos == "WR")
te_projections <- my_projections %>%
filter(pos == "TE")
# View each position-specific data frame
View(qb_projections)
View(rb_projections)
View(wr_projections)
View(te_projections)
#?add_adp
#?add_aav
view(my_projections)
Hi. How do I make sure my code has PPR scoring in it? And also, how can I interpret the "add_risk" variable? Thanks! Here's my code: