0

Issue

I am trying to read in the table from a website, specifically this website: https://www.nba.com/stats/teams/traditional/?sort=W_PCT&dir=-1&Season=2004-05&SeasonType=Regular%20Season

Here is how I went about it:

library(XML)
url <- "https://www.nba.com/stats/teams/traditional/?sort=W_PCT&dir=-1&Season=2004-05&SeasonType=Regular%20Season"
nbadata <- readHTMLTable(url,header=T, which = 1, stringAsFactors = F)

I am getting an error message that I am not familiar with:

Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘readHTMLTable’ for signature ‘"NULL"’ In addition: Warning message: XML content does not seem to be XML: 'Season'


Questions

  1. Where do I go wrong in my coding? Is XML the correct approach?

  2. What does the error message mean?

  3. I want to be able to extract the table from the 04-05 season all the way through to the 20-21 season. (You can see that the website offers a filter at the top left of the table that allows you to filter through seasons.) Is there an efficient way to extract each table from each season?

LoveMYMAth
  • 111
  • 5
  • This is the seccond poorly written question you have posted today. Please take your time to read the guidelines presented here: https://stackoverflow.com/help/how-to-ask https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – GuedesBF Nov 22 '21 at 16:37
  • Please go thtough the links i provided. This question is not nearly focused enough – GuedesBF Nov 22 '21 at 17:04
  • There you go, I think I fixed it. – LoveMYMAth Nov 22 '21 at 17:20
  • Thanks for considering the suggestions. Your question is now much more clear, although a bit broad. I retracted the close vote and the downvote – GuedesBF Nov 22 '21 at 17:25

0 Answers0