Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
weitinglin committed Feb 14, 2016
2 parents 1f3e75d + 717f1f7 commit 625ff74
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions medicaldatabase.R
Original file line number Diff line number Diff line change
Expand Up @@ -346,32 +346,4 @@ if(i>1){

return(Medical_database)
} # big function
lab_data[data_list[[1]]-1]%>%getlabname()
##Another Way to Deal with the Data with XML package
install.packages("XML")
library(XML)
library(xml2)
htm_data<-read_html("testlab.html",encoding = "BIG-5")
htm_data<-iconv(htm_data,from ="BIG-5",to = "UTF-8")

#xml parse
htm_parse<-xmlParse(htm_data,encoding="UTF-8")
htmfiles<-xmlRoot(htm_parse)
xmlChildren(htmfiles)
#explore the data structure
xmlName(htmfiles)
xmlSize(htmfiles)
names(htmfiles)
#digging further
htmfiles[]
#parse based on string html
test<-htmlTreeParse(htm_data,useInternalNodes = T)

#getNodeSet
notset<-getNodeSet(test,"//table")
notset_tr<-getNodeSet(htmfiles,"//tr")
noteset_tr_tt<-getNodeSet(htmfiles,"//tt")
notset_tr[[8]]
class(notset_tr)
noteset_tr_tt[30]
xmlAttrs(noteset_tr_tt)

0 comments on commit 625ff74

Please sign in to comment.