Skip to content

Commit

Permalink
Minor fixes prerelease
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcaseb committed Jun 14, 2020
1 parent 633c366 commit 261ed3c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 14 deletions.
4 changes: 3 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ Imports:
mgcv,
progressr,
purrr,
stats,
stringr,
tibble,
tidyr,
tidyselect
tidyselect,
xgboost
Suggests:
furrr,
future
Expand Down
1 change: 1 addition & 0 deletions R/helper_scrape_gc.R
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ get_pbp_gc <- function(gameId) {
play_clock = NA_character_,
play_deleted = NA_real_,
play_type_nfl = NA_character_,
drive_yards_penalized = NA_real_,
end_clock_time = NA_character_,
end_yard_line = NA_character_
) %>%
Expand Down
4 changes: 2 additions & 2 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ read_csv(url('https://github.com/ryurko/nflscrapR-data/blob/master/play_by_play_
```

``` {r ex1-fs, warning = FALSE, message = FALSE}
#The 'gc' option specifies scraping gamecenter like nflscrapR does, as opposed to 'rs'
fast_scraper('2019_10_SEA_SF') %>%
clean_pbp() %>%
select(desc, play_type, ep, epa, home_wp, name) %>% head(6) %>%
Expand Down Expand Up @@ -186,8 +185,9 @@ Even though `nflfastR` is very fast, **for historical games we recommend downloa

* To [Nick Shoemaker](https://twitter.com/WeightRoomShoe) for [finding and making available JSON-formatted NFL play-by-play back to 1999](https://github.com/CroppedClamp/nfl_pbps) (`nflfastR` uses this source for 1999-2010)
* To [Lee Sharpe](https://twitter.com/LeeSharpeNFL) for curating a resource for game information
* To [Timo Riske](https://twitter.com/PFF_Moo), [Lau Sze Yui](https://twitter.com/903124S), [Sean Clement](https://twitter.com/SeanfromSeabeck), and [Daniel Houston](https://twitter.com/CowboysStats) for many helpful discussions regarding the development of the new `nflfastR` models
* To [Zach Feldman](https://twitter.com/ZachFeldman3) and [Josh Hermsmeyer](https://twitter.com/friscojosh) for many helpful discussions about CPOE models
* To [Florian Schmitt](https://twitter.com/Flosch1006) for the logo design
* To [Zach Feldman](https://twitter.com/ZachFeldman3) for developing the CP model and recommending xgboost to us (which now drives the EP and WP models as well)
* To [Peter Owen](https://twitter.com/JSmoovesBrekkie) for [many helpful suggestions for the CP model](https://twitter.com/JSmoovesBrekkie/status/1268885950626623490)
* The many users who found and reported bugs in `nflfastR` 1.0
* And of course, the original [`nflscrapR`](https://github.com/maksimhorowitz/nflscrapR) team, Maksim Horowitz, Ronald Yurko, and Samuel Ventura, whose work represented a dramatic step forward for the state of public NFL research
26 changes: 15 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ read_csv(url('https://github.com/ryurko/nflscrapR-data/blob/master/play_by_play_
| (12:58) PENALTY on SEA-J.Reed, Encroachment, 5 yards, enforced at SF 41 - No Play. | no\_play | 2.286 | 0.774 | 0.551 |

``` r
#The 'gc' option specifies scraping gamecenter like nflscrapR does, as opposed to 'rs'
fast_scraper('2019_10_SEA_SF') %>%
clean_pbp() %>%
select(desc, play_type, ep, epa, home_wp, name) %>% head(6) %>%
Expand All @@ -122,7 +121,7 @@ repository](https://github.com/guga31bb/nflfastR-data) which hosts all
the scraped and cleaned data** whenever possible. The only reason to
ever actually use the scraper is if it’s in the middle of the season and
we haven’t updated the repository with recent games (but we will try to
keep it updated).
keep it updated).

``` r
#get list of some games from 2019
Expand All @@ -131,7 +130,7 @@ games_2019 <- fast_scraper_schedules(2019) %>% head(10) %>% pull(game_id)
tictoc::tic(glue::glue('{length(games_2019)} games with nflfastR:'))
f <- fast_scraper(games_2019, pp = TRUE)
tictoc::toc()
#> 10 games with nflfastR:: 12.35 sec elapsed
#> 10 games with nflfastR:: 14.46 sec elapsed
```

### Example 3: completion percentage over expected (CPOE)
Expand All @@ -146,7 +145,7 @@ reads .rds files, but .csv is also available).
tictoc::tic('loading all games from 2009')
games_2009 <- readRDS(url('https://raw.githubusercontent.com/guga31bb/nflfastR-data/master/data/play_by_play_2009.rds')) %>% filter(season_type == 'REG')
tictoc::toc()
#> loading all games from 2009: 2.65 sec elapsed
#> loading all games from 2009: 2.8 sec elapsed
games_2009 %>% filter(!is.na(cpoe)) %>% group_by(passer_player_name) %>%
summarize(cpoe = mean(cpoe), Atts=n()) %>%
filter(Atts > 200) %>%
Expand All @@ -158,10 +157,10 @@ games_2009 %>% filter(!is.na(cpoe)) %>% group_by(passer_player_name) %>%
| passer\_player\_name | cpoe | Atts |
| :------------------- | ---: | ---: |
| D.Brees | 7.4 | 509 |
| P.Rivers | 6.5 | 474 |
| P.Manning | 6.3 | 569 |
| B.Favre | 6.1 | 527 |
| B.Roethlisberger | 5.4 | 503 |
| P.Manning | 6.7 | 569 |
| P.Rivers | 6.6 | 474 |
| B.Favre | 6.0 | 527 |
| M.Schaub | 5.3 | 571 |

### Example 4: using drive information

Expand Down Expand Up @@ -309,11 +308,16 @@ Baldwin](https://twitter.com/benbbaldwin).
this source for 1999-2010)
- To [Lee Sharpe](https://twitter.com/LeeSharpeNFL) for curating a
resource for game information
- To [Timo Riske](https://twitter.com/PFF_Moo), [Lau Sze
Yui](https://twitter.com/903124S), [Sean
Clement](https://twitter.com/SeanfromSeabeck), and [Daniel
Houston](https://twitter.com/CowboysStats) for many helpful
discussions regarding the development of the new `nflfastR` models
- To [Zach Feldman](https://twitter.com/ZachFeldman3) and [Josh
Hermsmeyer](https://twitter.com/friscojosh) for many helpful
discussions about CPOE models
- To [Florian Schmitt](https://twitter.com/Flosch1006) for the logo
design
- To [Zach Feldman](https://twitter.com/ZachFeldman3) for developing
the CP model and recommending xgboost to us (which now drives the EP
and WP models as well)
- To [Peter Owen](https://twitter.com/JSmoovesBrekkie) for [many
helpful suggestions for the CP
model](https://twitter.com/JSmoovesBrekkie/status/1268885950626623490)
Expand Down
Binary file modified man/figures/README-ex5-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 261ed3c

Please sign in to comment.