XML包使用

来源:互联网 发布:百胜yum统一认证平台 编辑:程序博客网 时间:2024/06/06 02:12

最近更新请参照 http://cangfengzhe.github.com

htmlParse(url)

解析网页,或XML

xml 转换成data.frame

“`r
library(XML)
library(plyr)
url_path_pre <- ‘http://www.rcsb.org/pdb/rest/describePDB?structureId=4hhb,1hhb’
query_txt <- paste(structureId, collapse = ‘,’)
url_path <- paste(c(url_path_pre, query_txt), collapse = ”)
xml_txt <- htmlParse(url_path)
xml_list <- xmlToList(xml_txt)
title <- names(xml_listbodypdbdescription$pdb)

out <- ldply(xml_listbodypdbdescription, function(x) {
sapply(title, function(y){
assign(y, x[[y]])
})
} )
out

“`

0 0
原创粉丝点击