我想获取中间栏中的公司名称this http://www.consumercomplaints.in/bysubcategory/mobile-service-providers/page/1.html页面(以蓝色粗体书写),以及登记投诉者的位置指示符(例如“印度,德里”,以绿色书写)。基本上,我想要一个包含两列的表格(或数据框),一列用于公司,另一列用于位置。有任何想法吗?
您可以使用以下命令轻松完成此操作XML
封装在R
。这是代码
url = "http://www.consumercomplaints.in/bysubcategory/mobile-service-providers/page/1.html"
doc = htmlTreeParse(url, useInternalNodes = T)
profiles = xpathSApply(doc, "//a[contains(@href, 'profile')]", xmlValue)
profiles = profiles[!(1:length(profiles) %% 2)]
states = xpathSApply(doc, "//a[contains(@href, 'bystate')]", xmlValue)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)