fileURL <- "https://raw.githubusercontent.com/jey1987/DATA607/master/Week7_Assignment/books.json"
jsonURL <- getURL(fileURL)
fileURL <- "https://raw.githubusercontent.com/jey1987/DATA607/master/Week7_Assignment/books.xml"
xmlURL <- getURL(fileURL)
fileURL <- "https://raw.githubusercontent.com/jey1987/DATA607/master/Week7_Assignment/books.html"
htmlURL <- getURL(fileURL)
df_JSON <- fromJSON(jsonURL)
df_XML <- xmlToDataFrame(xmlURL)
df_HTML <- readHTMLTable(htmlURL)
df_JSON
## $favourite_books
## $favourite_books[[1]]
## $favourite_books[[1]]$bookname
## [1] "The Lost Symbol"
##
## $favourite_books[[1]]$Author
## [1] "Dan Brown"
##
## $favourite_books[[1]]$Genre
## [1] "Fantasy"
##
## $favourite_books[[1]]$`Language Written`
## [1] "English"
##
## $favourite_books[[1]]$`Copies Sold`
## [1] "1000000"
##
## $favourite_books[[1]]$`Number of Reviews`
## [1] "120"
##
##
## $favourite_books[[2]]
## $favourite_books[[2]]$bookname
## [1] "2 States"
##
## $favourite_books[[2]]$Author
## [1] "Chetan Bhagat"
##
## $favourite_books[[2]]$Genre
## [1] "Love"
##
## $favourite_books[[2]]$`Language Written`
## [1] "Hindi"
##
## $favourite_books[[2]]$`Copies Sold`
## [1] "12000"
##
## $favourite_books[[2]]$`Number of Reviews`
## [1] "90"
##
##
## $favourite_books[[3]]
## $favourite_books[[3]]$bookname
## [1] "Thirukkural"
##
## $favourite_books[[3]]$Author
## [1] "Thiruvalluvar"
##
## $favourite_books[[3]]$Genre
## [1] "Life Science"
##
## $favourite_books[[3]]$`Language Written`
## [1] "Tamil"
##
## $favourite_books[[3]]$`Copies Sold`
## [1] "100000000"
##
## $favourite_books[[3]]$`Number of Reviews`
## [1] "10000"
df_XML
## book_name
## 1 The Lost Symbol\n Dan Brown \n Fantasy \n English \n1000000\n120\n
## 2 2 States\n Chetan Bhagat \n Love \n Hindi \n12000\n90\n
## 3 Thirukkural\n Thiruvalluvar \n Life Science \n Tamil \n1000000000\n10000\n
df_HTML
## $`NULL`
## The Lost Symbol Dan Brown Fantasy English 1000000 120
## 1 2 States Chetan Bhagat Love Hindi 12000 90
## 2 Thirukkural Thiruvalluvar Life Science Tamil 100000000 10000
The three dataframes are not identical. HTML and JSON are of type List, XML is of format table. The data retrieved is also different.