library(jsonlite)
library(XML)
## Warning: package 'XML' was built under R version 4.3.3
library(rvest)
## Warning: package 'rvest' was built under R version 4.3.3
library(httr)
## Warning: package 'httr' was built under R version 4.3.3
json_data <- fromJSON("https://raw.githubusercontent.com/zachrose97/Data607Assignment7/refs/heads/main/BooksJson.json")
xmlURL <- "https://raw.githubusercontent.com/zachrose97/Data607Assignment7/main/BooksXml.xml"
response <- GET(xmlURL)
content <- content(response, as = "text")
doc <- xmlTreeParse(content, asText = TRUE, useInternal = TRUE)
xml_data <- xmlToDataFrame(doc)
html_data <- read_html("https://raw.githubusercontent.com/zachrose97/Data607Assignment7/refs/heads/main/BooksHtml.html") %>%
  html_table(fill = TRUE) %>%
  .[[1]]
identical(json_data, xml_data)
## [1] FALSE
identical(json_data, html_data)
## [1] FALSE
identical(xml_data, html_data) 
## [1] FALSE
print(json_data)
##                                                                  title
## 1                        The Optimist: A Case for the Fly Fishing Life
## 2                                                          How to Fish
## 3 Strip-Set: Fly-Fishing Techniques, Tactics, & Patterns for Streamers
##                     authors year       publisher
## 1             David Coggins 2021        Scribner
## 2               Chris Yates 2006   Penguin Books
## 3 George Daniel, Pat Dorsey 2015 Stackpole Books
print(xml_data)
##                                                                  title
## 1                        The Optimist: A Case for the Fly Fishing Life
## 2                                                          How to Fish
## 3 Strip-Set: Fly-Fishing Techniques, Tactics, & Patterns for Streamers
##                     authors year       publisher
## 1             David Coggins 2021        Scribner
## 2               Chris Yates 2006   Penguin Books
## 3 George Daniel, Pat Dorsey 2015 Stackpole Books
print(html_data)
## # A tibble: 3 × 4
##   Title                                       Authors `Year Published` Publisher
##   <chr>                                       <chr>              <int> <chr>    
## 1 The Optimist: A Case for the Fly Fishing L… David …             2021 Scribner 
## 2 How to Fish                                 Chris …             2006 Penguin …
## 3 Strip-Set: Fly-Fishing Techniques, Tactics… George…             2015 Stackpol…

After loading and comparing the three data frames, it can be seen that they are not identical to one another.