I get the following error when running the following command
game_odds <- map_dfr(games_eventids, ~ game_odds_func(eventId = .x))
Error in `dplyr::bind_rows()`:
! Can't combine `.51$odds` <data.frame> and `..52$odds` <list>.
Run `rlang::last_trace()` to see where the error occurred.
I have narrowed down the issue but need some assistance addressing the issue. As you can see, list 51 actually contains data
[[51]]$odds
id game_id
market_name sports_book_name name
1 12253-31516-2024-02-24:betonline:moneyline:anaheim_ducks 12253-31516-
2024-02-24 Moneyline BetOnline Anaheim Ducks
Whereas, list 52 is an empty list with no data.
[[52]]$odds
list()
Is there syntax that I can add to the map_dfr command that will just skip any lists that do not have any data.
You can remove the non data frame elements.
Instead of
map_dfusemapto creategame_odds. With this you'll get a list of df's.Filter to exclude the non data frame alementes
Created on 2024-02-23 with reprex v2.0.2