##Rpubs Source code:
HTML - https://github.com/jonburns2454/DATA607/blob/main/Book%20List.html
XML - https://github.com/jonburns2454/DATA607/blob/main/Book%20list.xml
JSON - https://github.com/jonburns2454/DATA607/blob/main/Book%20list.JSON
##Packages Used
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.2 ✔ readr 2.1.4
## ✔ forcats 1.0.0 ✔ stringr 1.5.0
## ✔ ggplot2 3.4.3 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.0
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(RCurl)
##
## Attaching package: 'RCurl'
##
## The following object is masked from 'package:tidyr':
##
## complete
library('XML')
library(rjson)
library(jsonlite)
##
## Attaching package: 'jsonlite'
##
## The following objects are masked from 'package:rjson':
##
## fromJSON, toJSON
##
## The following object is masked from 'package:purrr':
##
## flatten
library(kableExtra)
##
## Attaching package: 'kableExtra'
##
## The following object is masked from 'package:dplyr':
##
## group_rows
library(DT)
##HTML list to DataFrame
books_HTML_url <- getURL('https://raw.githubusercontent.com/jonburns2454/DATA607/main/Book%20List.html')
books_HTML <- readHTMLTable(books_HTML_url, header = T)
class(books_HTML)
## [1] "list"
Creating a more readable df and renaming it from NULL to books_HTML
class(books_HTML$`NULL`)
## [1] "data.frame"
books_html_DF <- books_HTML$`NULL`
class(books_html_DF)
## [1] "data.frame"
html_table <- datatable(books_html_DF)
html_table
##XML Book list –> Data.Frame
books_XML_URL <- getURL("https://raw.githubusercontent.com/jonburns2454/DATA607/main/Book%20list.xml")
books_XML <- xmlParse(books_XML_URL)
books_root <- xmlRoot(books_XML)
books_root_DF <- xmlToDataFrame(books_root)
xlm_table <- datatable(books_root_DF)
xlm_table
##JSON List –> Data.Frame
json_books_url <- getURL('https://raw.githubusercontent.com/jonburns2454/DATA607/main/Book%20list.JSON')
json_books <- fromJSON(json_books_url)
class(json_books$FantasyBooks)
## [1] "data.frame"
json_df <- json_books$FantasyBooks
json_table <- datatable(json_df)
json_table
##Conclusion
- While the three data methods are collected and structured differently the end result is effectively the same.
- If you look at the three tables I made at the end of each section, there is no convievable difference between the data presentation either.