hoopR icon indicating copy to clipboard operation
hoopR copied to clipboard

load_nba_schedule() returns a broken data.table object

Open grayskripko opened this issue 2 years ago • 4 comments

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 image

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()

grayskripko avatar Sep 08 '22 22:09 grayskripko

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.

saiemgilani avatar Sep 13 '22 10:09 saiemgilani

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?

grayskripko avatar Sep 15 '22 17:09 grayskripko

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*

saiemgilani avatar Sep 23 '22 22:09 saiemgilani

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.

grayskripko avatar Sep 24 '22 21:09 grayskripko