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].

loading the packages

library(XML)
library(RCurl)
library(jsonlite)
library(kableExtra)

Loading the HTML table file - books.html from GitHub link into a data. frame:

books.html.url <- "https://raw.githubusercontent.com/IvanGrozny88/books/main/DATA607_assigment5.html"
books.html.content <- getURL(books.html.url)
books.html.df <- as.data.frame(readHTMLTable(books.html.content))
books.html.df %>% kable() %>% kable_styling()
NULL.Name NULL.Authors. NULL.Genres. NULL.Original.language. NULL.Originally.published.
Rich Dad Poor Dad Robert Kiyosaki, Sharon Lechter Personal finance, Non-fiction  English 1997
Why We Want You to Be Rich:  Donald Trump, Robert Kiyosaki Self-help book  English 10.1.2006
Harry Potter and the Half-Blood Prince J. K. Rowling  Novel, Young adult fiction, Fantasy Fiction, Adventure fiction  English 16-Jul-05

Loading the XML file - books.xml from GitHub link into a data. frame:

books.xml.url <- "https://raw.githubusercontent.com/IvanGrozny88/books/main/DATA607_Assigment5.xml"
books.xml.content <- getURL(books.xml.url)
books.xml.df <- xmlToDataFrame(books.xml.content)
books.xml.df %>% kable() %>% kable_styling()
book
Rich Dad Poor DadRobert KiyosakiSharon LechterPersonal finance, Non-fictionEnglish1997
Why We Want You to Be RichDonald TrumpRobert KiyosakiSelf-help bookEnglish2006
Harry Potter and the Half-Blood PrinceJ.K.RowlingNovel, Young adult fiction, Fantasy Fiction, Adventure fictionEnglish2005

Loading the JSON file - books. Json from GitHub links into a data. frame:

books.json.url <- "https://raw.githubusercontent.com/IvanGrozny88/books/main/DATA607_assigment5.json"
books.json.content <- getURL(books.json.url)
books.json.df <- as.data.frame(fromJSON(books.json.content))
books.json.df %>% kable() %>% kable_styling()
book_table.book.Title book_table.book.Author.s. book_table.book.Genres book_table.book.Originallanguage book_table.book.Originallypublished
Rich Dad Poor Dad Robert Kiyosaki, Sharon Lechter Personal finance, Non-fiction English 1997
>Why We Want You to Be Rich Donald Trump , Robert Kiyosaki Self-help book. English 2006
Harry Potter and the Half-Blood Prince J.K.Rowling Novel, Young adult fiction, Fantasy Fiction, Adventure fiction English 2005