Instructions

Load libary
library(DT)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(htmltools)
library(readr)
library(aws.s3)
library(jsonlite)
library(RCurl)
library(XML)
Read URLs from GitHub
xml_url <- "https://raw.githubusercontent.com/Meccamarshall/Data607/main/Assignment%207/books.xml"
json_url <- "https://raw.githubusercontent.com/Meccamarshall/Data607/main/Assignment%207/books.JSON"
html_url <- "https://raw.githubusercontent.com/Meccamarshall/Data607/main/Assignment%207/books.html"
HTML
library(rvest)
##
## Attaching package: 'rvest'
## The following object is masked from 'package:readr':
##
## guess_encoding
html_file <- getURL(html_url)
html_df <- readHTMLTable(html_file, which = 1)
html_df
## Title Author ISBN-13
## 1 Black Girls Must Die Exhausted Jayne Allen 9780063137905
## 2 The Coldest Winter Ever Sister Souljah 9780743270106
## 3 One of the Good Ones Malika Moulite, Martiza Moulite 9781335426253
## Publication Year Pages
## 1 2021 368
## 2 2005 368
## 3 2022 352
datatable(html_df)
JSON
json_df <- as.data.frame(fromJSON(json_url))
names(json_df) <- c("Title","Author", "ISBN-13", "Publication Year","Pages")
json_df
## Title Author ISBN-13
## 1 Black Girls Must Die Exhausted Jayne Allen 9780063137905
## 2 The Coldest Winter Ever Sister Souljah 9780743270106
## 3 One of the Good Ones Malika Moulite, Martiza Moulite 9781335426253
## Publication Year Pages
## 1 2021 368
## 2 2005 368
## 3 2022 352
datatable(json_df)
XML
xml_file <- getURL(xml_url)
xml_df <- xmlToDataFrame(xml_file)
xml_df
## title authors isbn13
## 1 Black Girls Must Die Exhausted Jayne Allen 9780063137905
## 2 The Coldest Winter Ever Sister Souljah 9780743270106
## 3 One of the Good One Malika MouliteMartiza Moulite 9781335426253
## publicationyear pages
## 1 2021 368
## 2 2005 368
## 3 2022 352
datatable(xml_df)