xml - R readHTMLTable failed to load external entity -
this question has answer here:
- r error using readhtmltable 2 answers
when run line on laptop,
table500 <- readhtmltable('http://en.wikipedia.org/wiki/list_of_s%26p_500_companies')[[1]]
it gets data. when run on desktop, receive error
error: failed load external entity "http://en.wikipedia.org/wiki/list_of_s%26p_500_companies".
so i'm guessing problem has network settings in desktop, haven't slightest idea though. suggestions?
in link mentioned in comment, can find solutions using rcurl
, httr
package. here, provide solution using rvest
package.
library(rvest) kk<-html("http://en.wikipedia.org/wiki/list_of_s%26p_500_companies")%>% html_table(fill=true)%>% .[[1]] //table 1 head(kk) ticker symbol security sec filings gics sector gics sub industry address of headquarters 1 mmm 3m company reports industrials industrial conglomerates st. paul, minnesota 2 abt abbott laboratories reports health care health care equipment & services north chicago, illinois 3 abbv abbvie reports health care pharmaceuticals north chicago, illinois 4 acn accenture plc reports information technology consulting & other services dublin, ireland 5 ace ace limited reports financials property & casualty insurance zurich, switzerland 6 act actavis plc reports health care pharmaceuticals dublin, ireland date first added cik 1 66740 2 1800 3 2012-12-31 1551152 4 2011-07-06 1467373 5 2010-07-15 896159 6 884629
Comments
Post a Comment