HTML and JSON
2026-10-14
I chose three books about the mathematical and statistical foundations of data science. For each book, I will use the title, authors, publication year, publisher, and ISBN. All three books have more than one author.
I will create the same records in two formats:
books.html, using an HTML tablebooks.json, using an array of JSON objectsI will enter the files by hand so I can practice the structure of each format.
I will use rvest to read the HTML table and jsonlite to read the JSON file. After importing the files, I will check the number of rows and columns, column names, and data types.
Before using identical(), I will put the columns in the same order. I will also make Year an integer and ISBN a character field in both data frames. ISBN is an identifier, so it should not be used as a numeric value.
I will check for missing values and duplicate rows. I will also test the ISBN-13 check digits. The ISBN test only checks whether the number follows the ISBN-13 formula. It does not confirm the book title or edition.
HTML and JSON may import the same value with different data types. If the data frames look the same but identical() returns FALSE, I will check their structure before changing any values.
I will check the book information against the publishers’ pages before I finish the files.
I expect both files to produce data frames with three rows and five columns. After the column order and types are consistent, I expect the two data frames to match.