0

I'm trying to execute an example from book "Practical Data Science Cookbook" the code as following :

year <- 2013

#Acquire offense data
  url <- paste("http://sports.yahoo.com/nfl/stats/byteam?  group=Offense&cat=Total&conference=NFL&year=season_",
         year,"&sort=530&old_category=Total&old_group=Offense")

offense <- readHTMLTable(url, encoding = "UTF-8", colClasses="character")[[7]]

and getting error :

Error in UseMethod("xmlNamespaceDefinitions") : 
 no applicable method for 'xmlNamespaceDefinitions' applied to an object of class "NULL"

Please help

Toren
  • 6,648
  • 12
  • 41
  • 62
  • 1
    Interesting, I don't get any error (using Windows 7, {XML] 3.98-1.1 and {RCurl} 1.95-4.3). Maybe you need to update some packages? – lukeA Jan 18 '15 at 13:30
  • I know what is it ! It could be the proxy definition , because I work in enterprize environment , so how to configure proxy settings for readHTMLTable ? – Toren Jan 18 '15 at 13:34
  • would begin to check around these: http://stackoverflow.com/questions/6467277/proxy-setting-for-r – Colonel Beauvel Jan 18 '15 at 13:36
  • Look here https://www.google.com/search?q=r+"rcurl"+"proxy" – lukeA Jan 18 '15 at 13:37
  • Give the `rvest` package a look, it has some great parsing tools that work pretty generally. – Statwonk Jan 18 '15 at 13:57

1 Answers1

0

To solve the problem need to configure http proxy . On Windows desktop edit R-Studio shortcut , add after R-Studio name proxy definitions

 http_proxy=http://user_id:passwod@your_proxy:your_port/

source: Proxy settings for R

Community
  • 1
  • 1
Toren
  • 6,648
  • 12
  • 41
  • 62
  • For some URLs like this one, I have to use readHTMLtable( readLines(url),...) or I get that error even with the proxy configured. – Chris S. Jan 22 '15 at 18:44