DATA 607 WEEK 7 ASSIGNMENT
WORKING WITH HTML, XML AND JSON IN R
March 26, 2019

SOURCE FILES, R SCRIPTS AND RMARKDOWN ON GITHUB

KLEBER PEREZ           RPUBS GITHUB


Favorite books and subjects!

Please make a selection to continue..

HTML books

Reading HTML Table Format

# html variable in R 
url_html <- read_html("https://raw.githubusercontent.com/kleberperez1/CUNY-SPS-Data607-Week7-Assignment/master/books.html")

tabs <- url_html %>%
  html_nodes("table") %>%
  html_table(fill = TRUE)
html_frame <- tabs[[1]]

kable(html_frame) %>%
  kable_styling(bootstrap_options = "striped", font_size = 10) %>%
  scroll_box()
Title Authors Genre Publisher Year ISBN QR Code Price
QR Codes For The Creative Business Person Dr. Chris Thomas Self help Milton Contact Limited 2012 9780956264992 NA $16
Scan Me: Everybody’s Guide to the Magical World of QR Codes Mick Winter Guide Westsong Publishing 2011 9780965900034 NA $15.95
40 Ways to Use QR Codes For Mobile Marketing Jeff A Hamilton, Joan Mullally, Andrew P Simon Guide External Spiral Books 2013 None NA $2.99


Go to top


XML books  

Reading XML File Format

xmlfile<-getURL("https://raw.githubusercontent.com/kleberperez1/CUNY-SPS-Data607-Week7-Assignment/master/books.xml")
xmlBooks<-tbl_df(xmlToDataFrame(xmlfile))

xmlBooks %>% kable() %>% kable_styling(bootstrap_options = "striped", font_size = 10) %>% scroll_box()
title authors genre publisher year isbn price
QR Codes For The Creative Business Person Dr. Chris Thomas Self help Milton Contact Limited 2012 9780956264992 $16
Scan Me: Everybody’s Guide to the Magical World of QR Codes Mick Winter Guide Westsong Publishing 2011 9780965900034 $15.95
40 Ways to Use QR Codes For Mobile Marketing Jeff A Hamilton,Joan Mullally,Andrew P Simon Guide External Spiral Books 2013 None $2.99


Go to top


JSON books

Reading JSON Syntax

jsonFile<-"https://raw.githubusercontent.com/kleberperez1/CUNY-SPS-Data607-Week7-Assignment/master/books.json"
isValidJSON(jsonFile)
## [1] TRUE
jsonbooks<-tbl_df(as.data.frame(fromJSON(jsonFile)))
jsonbooks %>% kable() %>% kable_styling(bootstrap_options = "striped", font_size = 10) %>% scroll_box()
Title Authors Genre Publisher Year ISBN QR.Code Price
QR Codes For The Creative Business Person Dr. Chris Thomas Self help Milton Contact Limited 2012 9780956264992 http://miltoncontact.co.uk/sites/default/files/imagecache/cat_grid_image/qr_code_book_cover-front.png $16
Scan Me: Everybody’s Guide to the Magical World of QR Codes Mick Winter Guide Westsong Publishing 2011 9780965900034 https://images-na.ssl-images-amazon.com/images/I/51Tbhu0t5xL._SX329_BO1,204,203,200_.jpg $15.95
40 Ways to Use QR Codes For Mobile Marketing Jeff A Hamilton, Joan Mullally, Andrew P Simon Guide External Spiral Books 2013 None https://images-na.ssl-images-amazon.com/images/I/51N7DgzLm6L._SY346_.jpg $2.99


Go to top


Conclusion

Conclusion

SOURCE FILES, R SCRIPTS AND RMARKDOWN ON GITHUB

RPUBS GITHUB

Go to top

 



Please email to: Kleber Perez for any suggestion.