library(XML)
library(htmltools)
library(jsonlite)
library(xml2)
library(DT)
library(htmlwidgets)
# for some R version DT may not be able to install use the following below to install
# install.packages("htmlwidgets", type = "binary") and
# install.packages("DT", type = "binary")
For each source I started with “read” directly from
computer. But each Data are attached with source codes to have
accessible urls.
Source Code: https://github.com/baa5234/class607/blob/main/Week%207%20Assignment/mathbooks.html
mathbooks_html <- readHTMLTable("/Users/blessinga/Desktop/Masters Data Science/week7_607/mathbooks.html")
mathbooks_html <- mathbooks_html[[1]]
datatable(mathbooks_html)
Source Code: https://github.com/baa5234/class607/blob/main/Week%207%20Assignment/mathbooks.json
mathbooks_xml <- xmlToDataFrame("/Users/blessinga/Desktop/Masters Data Science/week7_607/mathbooks.xml")
datatable(mathbooks_xml)
Source Code: https://github.com/baa5234/class607/blob/main/Week%207%20Assignment/mathbooks.xml
mathbooks_json_df <- "/Users/blessinga/Desktop/Masters Data Science/week7_607/mathbooks.json"
mathbooks_json2 <- jsonlite::fromJSON(mathbooks_json_df)
mathbooks_json <- as.data.frame(mathbooks_json2$books)
datatable(mathbooks_json)
Are the three data frames identical?
Yes the 3 data frames for HTML, XML, and Json are all identical. And also it can be tested using identical function.