URL <- read_html("https://raw.githubusercontent.com/Kingtilon1/DATA607/main/assignment7/wimpy.html")
URL %>% html_node("table") %>% html_table(header =TRUE, fill = TRUE)
## # A tibble: 3 × 4
## Title Author Illustrator Genre
## <chr> <chr> <chr> <chr>
## 1 Diary of a Wimpy Kid: Rodrick Rules Jeff Kiney Jeff Kiney Humo…
## 2 Franny K. Stein Jim Benton Jim Benton Humo…
## 3 The Talisman Peter Straub, Stehhen K… Tony Shast… Nove…
json_url <- "https://raw.githubusercontent.com/Kingtilon1/DATA607/main/assignment7/wimpy.json"
# Read the JSON data
json_data <- fromJSON(json_url)
json_data
## Title Author Illustrator
## 1 Diary of a Wimpy Kid: Rodrick Rules Jeff Kiney Jeff Kiney
## 2 Franny K. Stein Jim Benton Jim Benton
## 3 The Talisman Peter Straub, Stephen King Tony Shasteen
## Genre
## 1 Humor, Comedy, Young adult fiction
## 2 Humor, Science fiction, Fiction
## 3 Novel, Horror fiction, Dark fantasy
The xml followed a similar method to the json and html tables in that there was a language-specific function that parsed the xml file so it can be read as a table
xml = getURLContent("https://raw.githubusercontent.com/Kingtilon1/DATA607/main/assignment7/wimpy.xml")
xml = xmlParse(xml)
xml = xmlToDataFrame(xml)
xml
## Title Author Illustrator
## 1 Diary of a Wimpy Kid: Rodrick Rules Jeff Kiney Jeff Kiney
## 2 Franny K. Stein Jim Benton Jim Benton
## 3 The Talisman Peter Straub, Stephen King Tony Shasteen
## Genre
## 1 Humor, Comedy, Young adult fiction
## 2 Humor, Science fiction, Fiction
## 3 Novel, Horror fiction, Dark fantasy
all three files appeared the same, I just had to use the right functions