The main part of this exercise was writing the books.* files by hand. See my
library(XML)
## Warning: package 'XML' was built under R version 3.4.1
library(knitr)
library(jsonlite)
library(dplyr)
## Warning: package 'dplyr' was built under R version 3.4.2
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(rvest)
## Loading required package: xml2
##
## Attaching package: 'rvest'
## The following object is masked from 'package:XML':
##
## xml
books <- read_html("/Users/kailukowiak/OneDrive - CUNY School of Professional Studies/DATA 607 Repository/Assigments/Week_7/books.html")
books1 <- books %>% html_table() %>% as.data.frame()
books1 %>% kable()
| 1 |
Elements of Statistical Learning |
Trevor Hastie, Robert Tibshirani, Jerome Friedman |
Machine Learning |
Springer |
2009 |
R |
| 2 |
R for Data Science |
Hadley Wickham |
Data Science |
Oreilly |
2016 |
R |
| 3 |
Building Machine Learning Systems With Python |
Willi Richert, Luis Pedro Coelo |
Machine Learning |
Packt |
2016 |
Python |
doc <- "/Users/kailukowiak/OneDrive - CUNY School of Professional Studies/DATA 607 Repository/Assigments/Week_7/books.xml"
book = xmlParse(doc)
books2 <- xmlToDataFrame(book)
kable(books2)
| 01 |
Elements of Statistical Learning |
Trevor Hastie, Robert Tibshirani, Jerome Friedman |
Machine Learning |
Springer |
2009 |
R |
| 02 |
R for Data Science |
Hadley Wickham |
Data Science |
Oreilly |
2016 |
R |
| 03 |
Building Machine Learning Systems With Python |
Willi Richert, Luis Pedro Coelo |
Machine Learning |
Packt |
2016 |
Python |
url <- "/Users/kailukowiak/OneDrive - CUNY School of Professional Studies/DATA 607 Repository/Assigments/Week_7/books.json"
books3 = fromJSON(url)
kable(books3)
| 01 |
Elements of Statistical Learning |
Trevor Hastie, Robert Tibshirani, Jerome Friedman |
Machine Learning |
Springer |
2009 |
R |
| 02 |
R for Data Science |
Hadley Wickham |
Data Science |
Oreilly |
2016 |
R |
| 03 |
Building Machine Learning Systems With Python |
Willi Richert, Luis Pedro Coelo |
Machine Learning |
Packt |
2016 |
Python |
|
identical(books3, books2)
## [1] FALSE
They’re not quite identical, but pretty close.