Pick three of your favorite books on one of your favorite subjects. At least one of the books should have more than one author. For each book, include the title, authors, and two or three other attributes that you find interesting. Take the information that you've selected about these three books, and separately create three files which store the book's information in HTML (using an html table), XML, and JSON formats (e.g. "books.html", "books.xml", and "books.json"). To help you better understand the different file structures, I'd prefer that you create each of these files "by hand" unless you're already very comfortable with the file formats. Write R code, using your packages of choice, to load the information from each of the three sources into separate R data frames. Are the three data frames identical? Your deliverable is the three source files and the R code. If you can, package your assignment solution up into an .Rmd file and publish to rpubs.com. This will also require finding a way to make your three text files accessible from the web.
url1="https://raw.githubusercontent.com/chrisestevez/DataAnalytics/master/607Week7/607week7html.html"
url2="https://raw.githubusercontent.com/chrisestevez/DataAnalytics/master/607Week7/607week7json.json"
url3="https://raw.githubusercontent.com/chrisestevez/DataAnalytics/master/607Week7/607week7xml.xml"
Lhtml= getURL(url1)
Lxml =getURL(url3)
Ljson = getURL(url2)table = readHTMLTable(Lhtml, header = TRUE)
htmlDF = data.frame(table )
colnames( htmlDF) = c("Title","Authors","Publisher","YearPublished")
htmlDF## Title
## 1 Automated Data Collection with R
## 2 R for Everyone
## 3 Data Science for Business
## Authors Publisher
## 1 Simon Munzert, Christian Rubba, Peter Meibner, Dominic Nyhuis Wiley
## 2 Jared P. Lander Pearson
## 3 Foster Provost,Tom Fawcett O'Reilly
## YearPublished
## 1 2015
## 2 2015
## 3 2013
xmlh = xmlParse(Lxml)
xmlDF = xmlToDataFrame(xmlh)
xmlDF## title
## 1 Automated Data Collection with R
## 2 R for Everyone
## 3 Data Science for Business
## authorname publisher
## 1 Simon Munzert,Christian Rubba,Peter Meibner,Dominic Nyhuis Wiley
## 2 Jared P. Lander Pearson
## 3 Foster Provost,Tom Fawcett O'Reilly
## yearpublished
## 1 2015
## 2 2015
## 3 2013
jsonL = fromJSON(Ljson)
jsonL## $fbooks
## title
## 1 Automated Data Collection with R
## 2 R for Everyone
## 3 Data Science for Business
## authors
## 1 Simon Munzert, Christian Rubba, Peter Meibner, Dominic Nyhuis
## 2 Jared P. Lande
## 3 Foster Provost, Tom Fawcett
## publisher yearpublished
## 1 Wiley 2015
## 2 Jared P. Lande 2015
## 3 O'Reilly 2013
Are the three data frames identical?
Json,html tables load as list and XML is a data frame. The method might be different but the end result is identical.