Introduction

The objective of this task is to choose three favorite books and separately create three files in different formats. Personally, I enjoy reading books from different countries.

HTML

htmlurl <- getURLContent("https://raw.githubusercontent.com/ZIXIANNOW/DATA607week7/main/books.html")
htmldata <-readHTMLTable(htmlurl)
htmldata <-htmldata[[1]]
datatable(htmldata)

XML

xmlurl <- getURL("https://raw.githubusercontent.com/ZIXIANNOW/DATA607week7/main/books.xml")
xmldata <- xmlParse(xmlurl)
xmldata = xmlToDataFrame(xmldata)
datatable(xmldata)

JSON

jsonurl <- fromJSON("https://raw.githubusercontent.com/ZIXIANNOW/DATA607week7/main/books.json")
jsondata <- jsonurl[[1]]
jsondata <- as.data.frame(jsondata)
datatable(jsondata)

Comparison

str(htmldata)
## 'data.frame':    3 obs. of  4 variables:
##  $ Title              : chr  "How the Steel Was Tempered" "One Thousand and One Nights" "The Deep"
##  $ Author             : chr  "Nikolai Ostrovsky" "Maxfield Parrish" "Daveed Diggs, William Hutson, Jonathan Snipes"
##  $ Year of publication: chr  "1936" "1909" "2019"
##  $ Language           : chr  "Russian" "Arabic" "English"
str(xmldata)
## 'data.frame':    3 obs. of  4 variables:
##  $ Title   : chr  "How the Steel Was Tempered" "One Thousand and One Nights" "The Deep"
##  $ Author  : chr  "Nikolai Ostrovsky" "Maxfield Parrish" "Daveed Diggs, William Hutson, Jonathan Snipes"
##  $ Year    : chr  "1936" "1909" "2019"
##  $ Language: chr  "Russian" "Arabic" "English"
str(jsondata)
## 'data.frame':    3 obs. of  4 variables:
##  $ Title   : chr  "How the Steel Was Tempered" "One Thousand and One Nights" "The Deep"
##  $ Author  : chr  "Nikolai Ostrovsky" "Maxfield Parrish" "Daveed Diggs, William Hutson, Jonathan Snipes"
##  $ Year    : chr  "1936" "1909" "2019"
##  $ Language: chr  "Russian" "Arabic" "English"

Conclusion

In summary, all the three data frames are identical even though information extracted from different file formats.