How to solve this error in a loop: "replacement has 30 rows, data has 29"?

I am an extreme amateur in R so I know for sure that I am messing something up but I am unable to figure it out from google.

I am working with the ncaahoopR package. I am attempting to use the function get_schedule with dict$ESPN as the input to pull the entire NCAA basketball schedule but I am running into this error: "Error in $<-.data.frame(*tmp*, "game_id", value = c("401169778", "401172236", : replacement has 30 rows, data has 29"

when using the below code

for (i in dict$ESPN){ get_schedule(i) } 

The result if I run the function with an index of the vector is below.

 game_id date opponent location team_score opp_score record 1 401172259 2019-11-05 Bryant A 73 71 1-0 (0-0) 2 401171927 2019-11-09 Canisius H 75 68 2-0 (0-0) 3 401172062 2019-11-13 Quinnipiac H 70 68 3-0 (0-0) 4 401172260 2019-11-19 Sacred Heart A 63 84 3-1 (0-0) 5 401170379 2019-11-23 NJIT H 79 63 4-1 (0-0) 6 401170932 2019-11-26 UMass Lowell A 63 75 4-2 (0-0) 7 401172261 2019-11-30 Navy H 56 76 4-3 (0-0) 8 401172262 2019-12-04 Merrimack H 82 55 5-3 (0-0) 9 401170975 2019-12-07 Stony Brook A 63 79 5-4 (0-0) 10 401168464 2019-12-10 St. John's A 71 82 5-5 (0-0) 11 401168277 2019-12-28 Duke A 50 75 5-6 (0-0) 12 401170216 2020-01-02 Rhode Island H 85 75 6-6 (0-0) 13 401172263 2020-01-07 Johnson & Wales RI H 79 53 7-6 (0-0) 14 401172264 2020-01-17 Yale A 56 70 7-7 (0-1) 15 401172265 2020-01-24 Yale H 62 73 7-8 (0-2) 16 401172266 2020-01-31 Cornell H 74 63 8-8 (1-2) 17 401172267 2020-02-01 Columbia H 72 66 9-8 (2-2) 18 401172268 2020-02-07 Dartmouth H NA NA 19 401172269 2020-02-08 Harvard H NA NA 20 401172270 2020-02-14 Pennsylvania A NA NA 21 401172271 2020-02-15 Princeton A NA NA 22 401172272 2020-02-21 Columbia A NA NA 23 401172273 2020-02-22 Cornell A NA NA 24 401172274 2020-02-28 Princeton H NA NA 25 401172275 2020-02-29 Pennsylvania H NA NA 26 401172276 2020-03-06 Harvard A NA NA 27 401172277 2020-03-07 Dartmouth A NA NA 

I am pretty certain that it has to do with the data structures but I am not familiar enough to understand why so I would appreciate some help. Please let me know if I can provide any more useful information.

5

1 Answer

re-install the libraries. i had the same issue and posted on the github issues thread.

0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like