码迷,mamicode.com
首页 > Web开发 > 详细

R爬取网页信息

时间:2016-10-27 20:57:50      阅读:197      评论:0      收藏:0      [点我收藏+]

标签:utf-8   out   object   XML   ret   htm   reading   table   format   

#爬取电影票房信息
library(stringr)
library(XML)
library(maps)
#htmlParse()用来interpreting HTML
#创建一个object
movie_parsed<-htmlParse("http://58921.com/boxoffice/wangpiao/20161004",
                        encoding = "UTF-8")
#the next step:extract tables/data
#readHTMLTable() for identifying and reading out those tables
tables<-readHTMLTable(movie_parsed,stringsAsFactors=FALSE)
is.matrix(tables)
is.character(tables)
is.data.frame(tables)
is.list(tables)
#so we got an "list" format#

R爬取网页信息

标签:utf-8   out   object   XML   ret   htm   reading   table   format   

原文地址:http://www.cnblogs.com/zhp2016/p/6005440.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!