I have picked three of my favorite books. After creating html,xml,and Json file Ihave exported them in R Studio.
install.packages("httr",repos = "http://cran.us.r-project.org")
## Installing package into 'C:/Users/malia/OneDrive/Documents/R/win-library/4.0'
## (as 'lib' is unspecified)
## package 'httr' successfully unpacked and MD5 sums checked
##
## The downloaded binary packages are in
## C:\Users\malia\AppData\Local\Temp\RtmpSEurqI\downloaded_packages
library(httr)
library(bitops)
library(RCurl)
library(dplyr)
##
## 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
## -- Attaching packages --------------------------------------- tidyverse 1.3.0 --
## v ggplot2 3.3.3 v purrr 0.3.4
## v tibble 3.1.0 v stringr 1.4.0
## v tidyr 1.1.3 v forcats 0.5.1
## v readr 1.4.0
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x tidyr::complete() masks RCurl::complete()
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(XML)
library(xml2)
library(rvest)
##
## Attaching package: 'rvest'
## The following object is masked from 'package:readr':
##
## guess_encoding
library(RJSONIO)
library(knitr)
library(stringr)
install.packages("htmltab",repos = "http://cran.us.r-project.org")
## Installing package into 'C:/Users/malia/OneDrive/Documents/R/win-library/4.0'
## (as 'lib' is unspecified)
## package 'htmltab' successfully unpacked and MD5 sums checked
##
## The downloaded binary packages are in
## C:\Users\malia\AppData\Local\Temp\RtmpSEurqI\downloaded_packages
##
## Attaching package: 'kableExtra'
## The following object is masked from 'package:dplyr':
##
## group_rows
url<-("https://raw.githubusercontent.com/maliat-hossain/FileProcessing/main/new%2016%20book.html")
HTMLBOOKdf<-htmltab(url)
## Argument 'which' was left unspecified. Choosing first table.
view(HTMLBOOKdf)
head(HTMLBOOKdf)
## Title Author Genre Year
## 2 Opekkha Humayun Ahmed Domestic Fiction 1997
## 3 Separation Anxiety Laura Zigman Humorous Fiction 2020
## 4 Freakonomics Steven Levitt, Stephen J. Dubner Nonfiction 2005
|
|
Title
|
Author
|
Genre
|
Year
|
|
2
|
Opekkha
|
Humayun Ahmed
|
Domestic Fiction
|
1997
|
|
3
|
Separation Anxiety
|
Laura Zigman
|
Humorous Fiction
|
2020
|
|
4
|
Freakonomics
|
Steven Levitt, Stephen J. Dubner
|
Nonfiction
|
2005
|
xml_books<-read_file("https://raw.githubusercontent.com/maliat-hossain/FileProcessing/main/new%2016XML.xml")
xmlbookdf<-xmlToDataFrame(xml_books)
View(xmlbookdf)
head(xmlbookdf)
## Title Author Genre Year
## 1 Opekkha Humayun Ahmed Domestic Fiction 1997
## 2 Separation Anxiety Laura Zigman Humorous Fiction 2020
## 3 Freakonomics Steven Levitt,Stephen J. Dubner Nonfiction 2005
jSON_books<-fromJSON("https://raw.githubusercontent.com/maliat-hossain/FileProcessing/main/new%2016json.json")
JSONbookdf<-as.data.frame(jSON_books)
kable(JSONbookdf)
|
Title
|
Author
|
Genre
|
Year
|
|
Opekhha
|
Humayun Ahmed
|
Domestic Fiction
|
1997
|
|
Separation Anxiety
|
Laura Zigman
|
Humorous Fiction
|
2020
|
|
Freakonomics
|
Steven Levitt,Stephen J. Dubner
|
Nonfiction
|
2005
|
## Title Author Genre Year
## 1 Opekhha Humayun Ahmed Domestic Fiction 1997
## 2 Separation Anxiety Laura Zigman Humorous Fiction 2020
## 3 Freakonomics Steven Levitt,Stephen J. Dubner Nonfiction 2005