|||
运用R语言获取四层ipc编码及分类
下边是结果示例,不想自己跑一遍的话可以留言获取全部
base='http://www.soopat.com'
bu=c('A','B','C','D','E','F','G','H')
allxnt=data.frame()
for(b in 7:8){
ipc=read_html(paste0('http://www.soopat.com/IPC/Parent/',bu[b]))
Tables=ipc%>%html_nodes('table')
erjis=Tables[1]%>%html_nodes('.IPCChild')%>%html_nodes('a')%>%html_attr('href')
for(e in 12:length(erjis)){
sipc=read_html(paste0(base,erjis[e]))
STables=sipc%>%html_nodes('table')
sanjis=STables[1]%>%html_nodes('.IPCChild')%>%html_nodes('a')%>%html_attr('href')
for(s in 1:length(sanjis)){
fouripc=read_html(paste0(base,sanjis[s])
FTables=fouripc%>%html_nodes('table')
fours=FTables[1]%>%html_nodes('.IPCChild')%>%html_nodes('a')%>%html_attr('href')
foursshuoming=FTables[1]%>%html_nodes('.IPCContentRow')%>%html_nodes('.IPCContent')%>%html_nodes('a')%>%html_text()
allxnt= rbind(allxnt,cbind(fours,foursshuoming) )
print(c(b,e,s))
}
Sys.sleep(2)
}
}
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-10-19 22:27
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社