Working with XML and JSON in R

Books Selected

I have picked the below three books (at random) from the Barnes & Nobles website:

  1. Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future ; by Ashlee Vance
  2. A Brief History of Time: From the Big Bang to Black Holes ; by Stephen Hawking
  3. 1066 Turned Upside Down; by Joanna Courtney / Hellen Hollick / Richard Dee / Alison Morton

Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic FutureA Brief History of Time: From the Big Bang to Black Holes1066 Turned Upside Down


File Generation

Have manually created the below three files “by hand” to capture the mentioned key information/attributes:

books.html
books.json
books.xml

  1. Name or Title of the book,
  2. Author(s) of the book,
  3. ISBN and BN Identifiers of the book,
  4. the publishing house,
  5. date of publishing, and
  6. the number of pages in the boook.

R Data Frames

We now load the information from each of the three files into separate R data frames and compare the structures:

HTML File Handling:

JSON File Handling:

XML File Handling:


Comments

Based on above we can see the data structures looks very similar. For the HTML file we can see the column names came with addtional NULL. value in it. We may need to diuring actual processing see how the data types handling would hold.