下附为题所在。
>html0403<-list()
>for (i in 1:100) {
urlab0403<-str_c(url0403,new0403$V1[1]) #获取真实地址,循环从1到100下载对应的网页
html0403[]<-read_html(urlab0403)
Sys.sleep(10)
setTxtProgressBar(progress_bar,i)
}
|=========================================================================================| 100%
>x<-html_nodes(html0403[[1]],".detail_main_right_conbg_con script") #选区节点 因为数据在 script 下
{xml_nodeset (4)}
[1] <script>origTime("3月26日17时51分新不列颠地区发生6.6级地震","2018-03-26 18:30:51");\n</script>
[2] <script>subStringLocationLatitude("-5.42");</script>
[3] <script>subStringLocationLongitude("151.31");</script>
[4] <script>shengdu("40.0");</script>
> class(x)
[1] "xml_nodeset"
> typeof(x)
[1] "list"
> as.data.frame(x[1])
Error in as.data.frame.default(x[1]) :
不能把""xml_nodeset""类别强迫变成数据框
如何保存?请求大神不吝赐教。


雷达卡


京公网安备 11010802022788号







