这方面不太懂,下面是一种比较笨的解决方法。
<br />
library(XML)<br />
library(stringr)<br />
theurl <- "http://vip.stock.finance.sina.com.cn/corp/go.php/vCB_AllNewsStock/symbol/sz000425.phtml"<br />
tables <- readHTMLTable(theurl)<br />
stockInfo <- tables[[18]]<br />
stockInfo <- as.character(stockInfo[2,])</p>
<p>dates <- unlist(str_extract_all(stockInfo, "[0-9]{4}-[0-9]{2}-[0-9]{2}"))<br />
news <- strsplit(stockInfo,"[0-9]{4}-[0-9]{2}-[0-9]{2}")[[1]][-1]<br />
times <- unlist(str_extract_all(news, "[0-9]{2}:[0-9]{2}"))<br />
news <- str_replace(news,"[0-9]{2}:[0-9]{2}","")<br />
news <- str_trim(news)</p>
<p>stockInfo <- data.frame(dates,times,news)<br />
</p>