1a. Read XML into R

url <- "https://raw.githubusercontent.com/ajbentley/cuny_ms_ds/master/607/mebooks.xml"

(booksx <- xmlParse(rawToChar(GET(url)$content)))
## <?xml version="1.0"?>
## <books>
##   <book>
##     <title>Amusing Ourselves To Death</title>
##     <author>Neil Postman</author>
##     <subject>Media Ecology</subject>
##     <year>1985</year>
##     <wiki>https://en.wikipedia.org/wiki/Amusing_Ourselves_to_Death</wiki>
##     <amazon>https://www.amazon.com/Amusing-Ourselves-Death-Discourse-Business/dp/014303653X/</amazon>
##     <isbn13>9780413404404</isbn13>
##   </book>
##   <book>
##     <title>Understanding Media</title>
##     <author>Marshall McLuhan</author>
##     <subject>Media Ecology</subject>
##     <year>1964</year>
##     <wiki>https://en.wikipedia.org/wiki/Understanding_Media</wiki>
##     <amazon>https://www.amazon.com/Understanding-Media-Extensions-Marshall-McLuhan/dp/0262631598</amazon>
##     <isbn13>9780262631594</isbn13>
##   </book>
##   <book>
##     <title>Of Ong and Media Ecology: Essays in Communication, Composition, and Literacy Studies</title>
##     <author>Thomas Farrell</author>
##     <author>Paul Soukup</author>
##     <subject>Media Ecology</subject>
##     <year>2012</year>
##     <amazon>https://www.amazon.com/Ong-Media-Ecology-Communication-Compositon/dp/161289075X/</amazon>
##     <isbn13>9781612890753</isbn13>
##   </book>
## </books>
## 

1b. Transform XML into data frame

Sadly I couldn't figure this one out.


2a. Read JSON into R

booksj <- jsonlite::fromJSON(txt = 'https://raw.githubusercontent.com/ajbentley/cuny_ms_ds/master/607/mebooks.json')

2b. Transform JSON into data frame

colnames(booksj) <- c("Title", "Author(s)", "Subject", "Year", "Wiki URL", "Amazon URL", "ISBN-13")

kable(booksj) %>% kable_styling(bootstrap_options = c("striped", "bordered"))
Title Author(s) Subject Year Wiki URL Amazon URL ISBN-13
Amusing Ourselves To Death Neil Postman Media Ecology 1985 https://en.wikipedia.org/wiki/Amusing_Ourselves_to_Death https://www.amazon.com/Amusing-Ourselves-Death-Discourse-Business/dp/014303653X/ 978-0413404404
Understanding Media Marshall McLuhan Media Ecology 1964 https://en.wikipedia.org/wiki/Understanding_Media https://www.amazon.com/Understanding-Media-Extensions-Marshall-McLuhan/dp/0262631598/ 978-0262631594
Of Ong and Media Ecology: Essays in Communication, Composition, and Literacy Studies Thomas Farrell and Paul Soukup Media Ecology 2012 NA https://www.amazon.com/Ong-Media-Ecology-Communication-Compositon/dp/161289075X/ 978-1612890753


3a. Read HTML into R

theurl <- getURL('https://raw.githubusercontent.com/ajbentley/cuny_ms_ds/master/607/mebooks.html',.opts = list(ssl.verifypeer = FALSE))
booksh <- readHTMLTable(theurl)

3b. Transform HTML into data frame

dfh <- as.data.frame(booksh)

colnames(dfh) <- c("Title", "Author(s)", "Subject", "Year", "Wiki URL", "Amazon URL", "ISBN-13")

kable(dfh) %>% kable_styling(bootstrap_options = c("striped", "bordered"))
Title Author(s) Subject Year Wiki URL Amazon URL ISBN-13
Amusing Ourselves To Death Neil Postman Media Ecology 1985 https://en.tdpedia.org/td/amusing_ourselves_to_death https://www.td.com/amusing-ourselves-death-discourse-business/dp/014303653x/ 978-0413404404
Understanding Media Marshall McLuhan Media Ecology 1964 https://en.tdpedia.org/td/understanding_media https://www.td.com/understanding-media-extensions-marshall-mcluhan/dp/0262631598 978-0262631594
Of Ong and Media Ecology: Essays in Communication, Compositon, and Literacy Studies Thomas Farrell and Paul Soukup Media Ecology 2012 https://www.td.com/ong-media-ecology-communication-compositon/dp/161289075x/ 978-1612890753