hoopR
hoopR copied to clipboard
load_nba_schedule() returns a broken data.table object
Describe the bug
load_nba_schedule()
returns somehow broken data.table object. The object throws an error on tail()
To Reproduce load_nba_schedule(2019:2022) %>% tail()
Screenshots
there as_tibble()
removes data.table
among the object classes.
UPD: the same problem is found for load_nba_team_box()
and load_nba_player_box()
I cannot say honestly whether this ought to be considered a defect or a documentation error. I am unsure of what exactly is causing conflict but I think you have pinpointed it. I appreciate the note, as a user, I would expect that the tail() should work, so I will need to make some changes to fix.
the easiest solition is not using data.table or remove it as I did in the topic. Where is come from? Do you use some hybrid of data.table and tidyverse?
The reason many of the functions are so fast is due to the usage of data.table. It isn't an accident that we are using it. I'm not sure if I should do as you've done above or simply update the documentation to indicate it is a data.table object. clarifying*
indicating that this is a data.table object doesn't solve the issue -- the final output object is broken. As a workaround: all user functions may return pure tibble objects but operate as it's faster. By the way: is it really faster to use data.table? In my experience the difference is negligible for medium size datasets.