Because that page has no data for Race 2, I;m getting the error - Error in matrix(NA_character_, nrow = n, ncol = maxp) : invalid 'ncol' value (too large or NA)
Is there any way for me to specify html_table to skip that?
I would like to kindly ask you to always provide your full code whenever you are asking for help on a forum. For example, it would greatly help if you also added how your page variable was created
The solution to your issue can be found in the possibly() function in the purrr package. It's a great function, which enables your code to keep running even if an error is encountered in the process. The following code scrapes all 15 tables on the link your provided.
The scraped_tables variable is a list of 15 elements (one of each table). The second element of the list is a NULL as specified in the otherwise argument in the possibly() function.
Thanks very much @gueyenono I read about possibly() recently and thought it was really cool but promptly forgot about its existence. It really solves this elegantly!
And thanks very much for the tip about full reproducibility, will do going forward. Apologies!