Loading Packages
library(XML)
library(jsonlite)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(RCurl)
## Loading required package: bitops
Reading HTML
(HTML.Dataframe <- readLines("https://raw.githubusercontent.com/Fyoun123/Data607/master/week%207/books.html") %>% htmlParse() %>% readHTMLTable(which = 1))
## Book Author
## 1 Steve Jobs Walter Isaacson
## 2 Our Oreintal Heritage Will Durant
## 3 The Grand Design Stephen Hawking and Leonard Mlodinow
## Genre
## 1 Biography
## 2 History
## 3 Popular science
Reading JSON
(JSON.Dataframe <- fromJSON("https://raw.githubusercontent.com/Fyoun123/Data607/master/week%207/books.json"))
## A B
## 1 Book Author
## 2 Steve Jobs Walter Isaacson
## 3 Our Oreintal Heritage Will Durant
## 4 The Grand Design Stephen Hawking and Leonard Mlodinow
## C
## 1 Genre
## 2 Biography
## 3 History
## 4 Popular science
Reading XML
xml_url<-getURL("https://raw.githubusercontent.com/Fyoun123/Data607/master/week%207/Books2.xml")
(XML.Dataframe<-xmlToDataFrame(xml_url, stringsAsFactors = FALSE))
## Books Author
## 1 Steve Jobs Walter Isaacson
## 2 Our Oreintal Heritage Will Durant
## 3 The Grand Design Stephen Hawking and Leonard Mlodinow
## Genre
## 1 Biography
## 2 History
## 3 Popular science
XML and HTML are smilar where as JSON is different.