maksimhorowitz / nflscrapR

R Package for Scraping and Aggregating NFL Data
522 stars 139 forks source link

Error when pulling multiple seasons #138

Closed mm0708 closed 4 years ago

mm0708 commented 4 years ago

I have a list of 864 gameIds I am trying to scrape in a list named game_ids.

Using the command

nflscrapR <- do.call(rbind, lapply(game_ids, function(x) scrape_json_play_by_play(x)))

I get the following error at some point during the scrape:

Error in "extra_point_good" : argument "table" is missing, with no default

sventura commented 4 years ago

Might be helpful to know the game ID(s) where this error occurs. Does the error persist if you only try to pull the data for that single game? A reproducible example will be helpful.

Also, remember that the already-compiled data lives here: https://ryurko.github.io/nflscrapR-data/

mm0708 commented 4 years ago

I went back and tried the same set of games as yesterday when I encountered the error but instead used a for loop (gross).

nflscrapR <- data.frame() for(i in 1:length(game_ids)) { game <- game_ids[i] scrape <- scrape_json_play_by_play(as.character(game_ids[i])) nflscrapR <- rbind(nflscrapR, scrape) }

This produced the desired result while the do.call() example above does not. Normally if I am only gathering a single season the do.call and apply method works without error. Perhaps I just got a bit unlucky with a network hiccup while I was taking in all the games. In any case, I'll close this error.

sventura commented 4 years ago

Okay, thanks, let us know if this issue persists.