library(XML)
library(jsonlite)
html_data <- readHTMLTable("books.HTML")
html_df <- as.data.frame(html_data)
html_df
## NULL.Title
## 1 The Complete Guide to Fasting: Heal Your Body Through Intermittent, Alternate-Day, and Extended Fasting
## 2 Delay, Don't Deny: Living an Intermittent Fasting Lifestyle
## 3 Fasting: Opening the door to a deeper, more intimate, more powerful relationship with God
## NULL.Author.s. NULL.Date.Published
## 1 Dr. Jason Fung; Jimmy Moore 10/18/2016
## 2 Gin Stephens 12/31/2016
## 3 Jentezen Franklin 12/14/2007
## NULL.Publisher NULL.ISBN
## 1 Victory Belt Publishing 1628600012
## 2 CreateSpace Independent Publishing Platform 1541325842
## 3 Charisma House 1599792583
xml_data <- xmlParse("books.xml")
xml_df <- xmlToDataFrame(xml_data)
xml_df
## TITLE
## 1 The Complete Guide to Fasting: Heal Your Body Through Intermittent, Alternate-Day, and Extended Fasting
## 2 Delay, Don't Deny: Living an Intermittent Fasting Lifestyle
## 3 Fasting: Opening the door to a deeper, more intimate, more powerful relationship with God
## AUTHOR DATE_PUBLISHED
## 1 Dr. Jason Fung; Jimmy Moore 10/18/2016
## 2 Gin Stephens 12/31/2016
## 3 Jentezen Franklin 12/14/2007
## PUBLISHER ISBN
## 1 Victory Belt Publishing 1628600012
## 2 CreateSpace Independent Publishing Platform 1541325842
## 3 Charisma House 1599792583
json_data <- fromJSON("books.json")
json_df <- as.data.frame(json_data)
json_df
## books.Title
## 1 The Complete Guide to Fasting: Heal Your Body Through Intermittent, Alternate-Day, and Extended Fasting
## 2 Delay, Don't Deny: Living an Intermittent Fasting Lifestyle
## 3 Fasting: Opening the door to a deeper, more intimate, more powerful relationship with God
## books.Author.s. books.Date.Published
## 1 Dr. Jason Fung; Jimmy Moore 10/18/2016
## 2 Gin Stephens 12/31/2016
## 3 Jentezen Franklin 12/14/2007
## books.Publisher books.ISBN
## 1 Victory Belt Publishing 1628600012
## 2 CreateSpace Independent Publishing Platform 1541325842
## 3 Charisma House 1599792583
The three data frames are nearly identical. The only difference is that a reference to the table name comes up with the HTML and XML data frames as, for example, NULL.Title and books.Title respectively. HTML wasn’t given a table name, explaining the null. The XML data was wrapped in a