Skip to content

Commit

Permalink
Fixing incorrect references, fix issue #1
Browse files Browse the repository at this point in the history
  • Loading branch information
MrDAndersen committed Aug 14, 2018
1 parent a362f2a commit f639f21
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: ffanalytics
Type: Package
Title: Scrape Data For Fantasy Football
Version: 0.1.0
Version: 2.0.0
Author: Dennis Andersen
Maintainer: Dennis Andersen <[email protected]>
Description: Scrapes data from multiple public sources of data and compiles into one dataset.
Expand Down
4 changes: 2 additions & 2 deletions R/adp_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,8 @@ ffc_draft <- function(format=c("standard", "ppr", "2qb", "dynasty", "rookie"),
fp_id = recode(fp_id, "ronald-jones" = "ronald-jones-ii",
"david-johnson" = "david-johnson-rb",
"michael-thomas" = "michael-thomas-wr")) %>%
add_column(id = ffwebscrape:::id_col(.$fp_id, "fantasypro_id"), .before = 1) %>%
mutate(id = ifelse(is.na(id), ffwebscrape:::match_players(.), id)) %>%
add_column(id = ffanalytics:::id_col(.$fp_id, "fantasypro_id"), .before = 1) %>%
mutate(id = ifelse(is.na(id), ffanalytics:::match_players(.), id)) %>%
rename(adp = overall)

}
6 changes: 3 additions & 3 deletions R/calc_projections.R
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ source_points <- function(data_result, scoring_rules){
dst_src <- long_result %>% slice(0) %>% add_column(points = 0)
if(dst_bracket){
dst_src <- long_result %>% filter(data_col == "dst_pts_allowed") %>%
mutate(points = ffwebscrape:::dst_points(stat_value, scoring$pts_bracket))
mutate(points = ffanalytics:::dst_points(stat_value, scoring$pts_bracket))
}

long_result %>%
Expand Down Expand Up @@ -222,14 +222,14 @@ projected_points <- function(agg_stats, scoring_rules){
dst_src <- agg_stats %>% slice(0) %>% add_column(points = 0)
if(dst_bracket){
dst_src <- agg_stats %>% filter(data_col == "dst_pts_allowed") %>%
mutate(points = ffwebscrape:::dst_points(stat_value, scoring_rules$pts_bracket))
mutate(points = ffanalytics:::dst_points(stat_value, scoring_rules$pts_bracket))
}

dst_agg <- dst_src %>% slice(0)

if(dst_bracket){
dst_agg <- agg_stats %>% filter(data_col == "dst_pts_allowed") %>%
mutate(points = ffwebscrape:::dst_points(stat_value, scoring_rules$pts_bracket))
mutate(points = ffanalytics:::dst_points(stat_value, scoring_rules$pts_bracket))
}
agg_stats %>%
inner_join(scoring_tbl, by = c("pos", "data_col")) %>%
Expand Down
4 changes: 2 additions & 2 deletions R/custom_scoring.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pos_scor <- function(pname, rule_list){
}

grp_rule <- function(x, p){
sp <- ffwebscrape:::scoring_positions[[p]]
sp <- ffanalytics:::scoring_positions[[p]]

map(x, ~ .x[intersect(names(.x), sp)]) %>% reduce(~ list_merge(.x,!!!.y)) %>%
modify_depth(2, sum)
Expand Down Expand Up @@ -96,7 +96,7 @@ custom_scoring <- function(...){
sr <- sr %>% discard(~ all(names(.) == "all_pos"))

ap <- sr[intersect(names(sr), c("rec", "rush", "misc", "ret", "idp"))]%>%
imap(~ list(all_pos = !any(ffwebscrape:::scoring_positions[[.y]] %in% names(.x))))
imap(~ list(all_pos = !any(ffanalytics:::scoring_positions[[.y]] %in% names(.x))))

sr %>% list_modify(!!! ap)
}
2 changes: 1 addition & 1 deletion R/scrape_ecr.R
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ scrape_ecr <- function(rank_period = c("draft", "weekly", "ros", "dynasty", "roo
rank_tbl <- rank_tbl %>% janitor::clean_names()

if(any(names(rank_tbl) == "fantasypro_id"))
rank_tbl <- rank_tbl %>% add_column(id = ffwebscrape:::id_col(rank_tbl$fantasypro_id, "fantasypro_id"), .before = 1)
rank_tbl <- rank_tbl %>% add_column(id = ffanalytics:::id_col(rank_tbl$fantasypro_id, "fantasypro_id"), .before = 1)

return(rank_tbl)
}
6 changes: 3 additions & 3 deletions data-raw/source_configs.R
Original file line number Diff line number Diff line change
Expand Up @@ -633,9 +633,9 @@ xlsx_sites <- list(
)
)
projection_sources <- append(append(
purrr::map(html_sites, do.call, what = ffwebscrape:::html_source$new),
purrr::map(json_sites, do.call, what = ffwebscrape:::json_source$new)),
purrr::map(xlsx_sites, do.call, what = ffwebscrape:::xlsx_source$new)
purrr::map(html_sites, do.call, what = ffanalytics:::html_source$new),
purrr::map(json_sites, do.call, what = ffanalytics:::json_source$new)),
purrr::map(xlsx_sites, do.call, what = ffanalytics:::xlsx_source$new)
)


Expand Down
Binary file modified data/projection_sources.rda
Binary file not shown.
2 changes: 1 addition & 1 deletion ffanalytics.Rproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ StripTrailingWhitespace: Yes
BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageRoxygenize: rd,collate,namespace
PackageRoxygenize: rd,collate,namespace,vignette

0 comments on commit f639f21

Please sign in to comment.