XML包使用

最近更新请参照 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_list body pdbdescription$pdb)

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

“`

你可能感兴趣的:(xml,R语言)