nflverse / nflfastR

A Set of Functions to Efficiently Scrape NFL Play by Play Data
https://www.nflfastr.com/
Other
425 stars 52 forks source link

calculate_player_stats #441

Closed Ic4ru5Wing closed 1 year ago

Ic4ru5Wing commented 1 year ago

Hi,

I am getting the following error when trying to load player stats from pbp:

Error in dplyr::mutate(): ℹ In argument: season = substr(.data$game_id, 1, 4) %>% as.integer(). Caused by error in .data$game_id: ! Column game_id not found in .data. Run rlang::last_trace() to see where the error occurred. Warning messages: 1: In readRDS(con) : URL 'https://github.com/nflverse/nflverse-data/releases/download/misc/multiple_lateral_yards.rds': status was 'SSL connect error' 2: Failed to readRDS from https://github.com/nflverse/nflverse-data/releases/download/misc/multiple_lateral_yards.rds

This has only been apparent in the last 24 hours or so and strangely does not affect defensive stats

I am at a loss as to what the issue might be

nflfastR package version 4.6.0 for Mac

tanho63 commented 1 year ago

Try using nflreadr's load_player_stats instead https://nflreadr.nflverse.com/reference/load_player_stats.html

Ic4ru5Wing commented 1 year ago

Hi, thanks for the rapid response The thing with using that function is that it doesn't actually calculate the stats The strange thing is it is now failing with the defensive stats as well and is giving the following error:Error in mutate(): ℹ In argument: passer_id = (function (id, id_vec = id_vector) .... Caused by error in dplyr::case_when(): ! ..3 (right) must be a vector, not NULL. Run rlang::last_trace() to see where the error occurred. Warning messages: 1: Unknown or uninitialised column: gsis_id. 2: Unknown or uninitialised column: esb_id.

Ic4ru5Wing commented 1 year ago

Sorry to be a pain but it seems the following functions are all failing so far:

load_ff_rankings() calculate_player_stats() calculate_player_stats_def() load_injuries() load_pfr_passing() load_pfr_advstats() load_snap_counts()

tanho63 commented 1 year ago

Please provide output of nflreadr::nflverse_sitrep(). Also try clearing the cache: https://nflreadr.nflverse.com/reference/clear_cache.html

Ic4ru5Wing commented 1 year ago

Hi,

first of all sorry for the late reply, I actually live in the UK so the time difference meant I wasn't able to right away

once again, thanks for the quick replies and all the help, it is very much appreciated

the issues now seem to have been resolved so it was maybe just a temporary glitch

could you give me some general advice on what the best course of action would be if it were to happen again?

I'm not an expert at all, mostly self-taught and pretty roughly at that

would the sitrep function help me identify things that maybe need attention?

Thanks again

tanho63 commented 1 year ago